我正在尝试在谷歌应用程序引擎中抓取网页,并将内容放入存储桶中的文件中。我在其中一个版本上短暂切换到了Python3,然后在下一个版本上又恢复到了python2。在我切换到python3之前,它就起作用了。
不确定是不是因为这个原因,但现在我的应用程序给出了这个错误:

我已经尝试过使用monkeyfix()函数。它们不起作用。在app.yaml中,运行时是python27。
有问题的代码片段:
def upload_blob(bucket_name, source_string, destination_blob_name):
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
blob = bucket.blob(destination_blob_name)
blob.upload_from_string(source_string)
...
upload_blob('[MY BUCKET NAME HERE]', content, destination_filename)这里有没有人以前遇到过这个问题?这是个bug吗?
发布于 2019-01-25 06:06:38
您需要使用以下命令对您的lib目录进行requests-toolbelt:
$ pip install -t lib requests-toolbelt然后执行以下操作:
from requests_toolbelt.adapters import appengine
appengine.monkeypatch()https://stackoverflow.com/questions/54355534
复制相似问题