question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HttpError 400 on uploading 0 bytes files, 416 on downloading 0 bytes files

See original GitHub issue

It seems like the bug #241 and @Aran-Fey’s problem happened again when i trying to download and upload 0 bytes file using google drive api.

    credentials = google.oauth2.credentials.Credentials(**token)
    services_account = googleapiclient.discovery.build(API_SERVICE_NAME, API_VERSION, credentials=credentials)
    fd= BytesIO()
    media = googleapiclient.http.MediaIoBaseUpload(fd=fd, chunksize=128, mimetype='text/plain', resumable=True)
    body = {'name' : 'foo.txt'}
    services_account.files().insert(body=body, media_body=media, fields='id').execute()

throws

    `googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/upload/drive/v2/files?fields=id&alt=json&uploadType=resumable
returned "Bad Request">`

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
busunkim96commented, Oct 21, 2020

Ah, I missed the download part of this. Re-opening.

2reactions
SurferJeffAtGooglecommented, Sep 18, 2020

We confirmed that other clients fetch 0-bytes files without error, so this must be an issue with the python client.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Files Become 0 Bytes? Top 3 Ways to Restore Zero Byte Files
This article will show you why a file becomes 0 bytes and how to restore zero bytes files on Windows computer. 3 feasible...
Read more >
How To Fix the HTTP 416 Error (4 Methods) - Kinsta
Also known as the “Range Not Satisfiable” error, the HTTP 416 error can be fixed using any of the four methods in this...
Read more >
Error Responses - Amazon Simple Storage Service
Error Code Description HTTP Status Code AccessControlListNotSupported The bucket does not allow ACLs. 400 Bad Request AccessDenied Access Denied 403 Forbidden BucketAlreadyOwnedByYou 409 Conflict (in all...
Read more >
Smoother Error Message for 0 bytes Attachment? - ServiceNow
Hi! We had a user try to upload an attachment of 0 bytes. They received a "Bad Request (400)" error: Bad Request (400)...
Read more >
HTTP status and error codes for JSON | Cloud Storage
mediaDownloadRedirect, When requesting a download using alt=media URL parameter, the direct URL path to use is prefixed by /download . If this is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found