-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Labels
api: storageIssues related to the googleapis/python-storage API.Issues related to the googleapis/python-storage API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- OS type and version: Linux rodete
- Python version: Python 3.8.5
- pip version: pip 20.0.2
google-cloud-storageversion: 1.30.0
Steps to reproduce
Run:
from google.cloud import storage
client = storage.Client()
bucket = client.get_bucket('fishbucket1')
blob2 = bucket.blob('file')
blob2.upload_from_string('hi')
blob2.download_as_string()
blob2.upload_from_string('hi')Stack trace
Traceback (most recent call last):
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/cloud/storage/blob.py", line 1910, in upload_from_file
created_json = self._do_upload(
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/cloud/storage/blob.py", line 1758, in _do_upload
response = self._do_multipart_upload(
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/cloud/storage/blob.py", line 1404, in _do_multipart_upload
response = upload.transmit(
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/resumable_media/requests/upload.py", line 148, in transmit
self._process_response(response)
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/resumable_media/_upload.py", line 116, in _process_response
_helpers.require_status_code(response, (http_client.OK,), self._get_status_code)
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/resumable_media/_helpers.py", line 106, in require_status_code
raise common.InvalidResponse(
google.resumable_media.common.InvalidResponse: ('Request failed with status code', 400, 'Expected one of', <HTTPStatus.OK: 200>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "t", line 7, in <module>
blob2.upload_from_string('hi')
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/cloud/storage/blob.py", line 2097, in upload_from_string
self.upload_from_file(
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/cloud/storage/blob.py", line 1925, in upload_from_file
_raise_from_invalid_response(exc)
File "/usr/local/google/home/aaxue/Documents/google/temp/lib/python3.8/site-packages/google/cloud/storage/blob.py", line 3262, in _raise_from_invalid_response
raise exceptions.from_http_status(response.status_code, message, response=response)
google.api_core.exceptions.BadRequest: 400 POST https://storage.googleapis.com/upload/storage/v1/b/fishbucket1/o?uploadType=multipart: ('Request failed with status code', 400, 'Expected one of', <HTTPStatus.OK: 200>)
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/python-storage API.Issues related to the googleapis/python-storage API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.