作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用一个简单的 python 程序将一个小文件上传到 gcloud
client = storage.Client(project=GCLOUD_PROJECT)
bucket = client.get_bucket(GCLOUD_BUCKET)
blob = bucket.blob(GCLOUD_FILE_ON_CLOUD)
blob.upload_from_filename(GCLOUD_FILE_LOCAL)
Traceback (most recent call last):
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/gcloud_upload.py", line 40, in <module>
blob.upload_from_filename(GCLOUD_FILE_LOCAL)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/gcloud/storage/blob.py", line 597, in upload_from_filename
encryption_key=encryption_key, client=client)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/gcloud/storage/blob.py", line 543, in upload_from_file
http_response = upload.stream_file(use_chunks=True)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/gcloud/streaming/transfer.py", line 1086, in stream_file
response = send_func(self.stream.tell())
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/gcloud/streaming/transfer.py", line 1215, in _send_chunk
return self._send_media_request(request, end)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/gcloud/streaming/transfer.py", line 1125, in _send_media_request
self.bytes_http, request, retries=self.num_retries)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/gcloud/streaming/http_wrapper.py", line 423, in make_api_request
check_response_func=check_response_func)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/gcloud/streaming/http_wrapper.py", line 371, in _make_api_request_no_retry
redirections=redirections, connection_type=connection_type)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/oauth2client/transport.py", line 175, in new_request
redirections, connection_type)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/oauth2client/transport.py", line 282, in request
connection_type=connection_type)
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/httplib2/__init__.py", line 1986, in request
cachekey,
File "/Users/mmumshad/PycharmProjects/quiz-python-flask-angular/venv36/lib/python3.6/site-packages/httplib2/__init__.py", line 1685, in _request
content,
httplib2.RedirectMissingLocation: Redirected but the response is missing a Location: header.
{
'content-type': 'text/plain; charset=utf-8',
'range': 'bytes=0-1048575',
'content-length': '0',
'date': 'Sun, 19 Jan 2020 23:52:13 GMT',
'server': 'UploadServer',
'alt-svc': 'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000',
'status': '308'}
adal 1.2.2
bson 0.5.8
cachetools 3.1.1
certifi 2019.9.11
cffi 1.13.1
chardet 3.0.4
cryptography 2.8
dnspython 1.16.0
gcloud 0.18.3
gitdb2 2.0.6
GitPython 3.0.5
google-auth 1.6.3
googleapis-common-protos 1.51.0
httplib2 0.16.0
idna 2.7
itsdangerous 1.1.0
MarkupSafe 1.1.1
oauth2client 4.1.3
oauthlib 3.1.0
pip 19.0.3
protobuf 3.11.2
pyasn1 0.4.7
pyasn1-modules 0.2.7
pycparser 2.19
PyJWT 1.7.1
python-dateutil 2.8.0
requests 2.19.1
requests-oauthlib 1.2.0
rsa 4.0
setuptools 40.8.0
six 1.12.0
smmap2 2.0.5
urllib3 1.23
websocket-client 0.56.0
Werkzeug 0.16.0
最佳答案
解决方案gcloud
包被弃用两次并且与 httplib2>=0.16
不兼容.正确的解决方法是使用 google-cloud-*
包家人。google-api-python-client>=1.7.12
正在使用redirect_codes API,请升级,它可以正常工作。
httplib2 v0.17.0 刚刚发布,能够修改被视为重定向的响应代码集。如果您可以修改创建 Http
的代码,这是最好的选择。目的:
http = httplib2.Http()
http.redirect_codes = http.redirect_codes - {308}
httplib2<0.16.0
google-cloud
关于python - GCloud 上传 httplib2.RedirectMissingLocation : Redirected but the response is missing a Location: header,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59815620/
我有以下正则表达式 /[a-zA-Z0-9_-]/ 当字符串只包含从 a 到z 大小写、数字、_ 和 -。 我的代码有什么问题? 能否请您向我提供一个简短的解释和有关如何修复它的代码示例? //var
我是一名优秀的程序员,十分优秀!