python - 可以在 Google App Engine 上使用 Python Requests 库吗?

标签 python google-app-engine python-requests

我可以使用 Requests在谷歌应用引擎上?我认为这个库非常适合创建 REST 客户端。

最佳答案

安装 requests-toolbelt 库: https://github.com/sigmavirus24/requests-toolbelt

对于 App Engine,它可能类似于:pip install requests-toolbelt -t lib

(参见:https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#installing_a_library)

然后添加:

from requests_toolbelt.adapters import appengine
appengine.monkeypatch()

在您的 main.py 或等效文件中。

编辑:这个解决方案现在是官方文档的一部分:https://cloud.google.com/appengine/docs/python/issue-requests#issuing_an_http_request (在 REQUESTS 选项卡中)

关于python - 可以在 Google App Engine 上使用 Python Requests 库吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9604799/

相关文章:

python - 在 Python 中将多字节字符转换为 7 位 ASCII

python - 如何省略 Sphinx 上的变量值?

google-app-engine - 如何在GAE中引入所需的属性

python - 了解 "runwithfriends"facebook-app 示例代码

python - 应用引擎 : convert ndb model to go lang struct

python - 如何请求已在 python-requests 中进行 URL 编码的 URL?

python - Unicode解码错误: 'ascii' codec can't decode byte 0xea in position 8: ordinal not in range(128)

python - 将 re 与变量列表参数一起使用

python - 如何为 APScheduler 3.0 传递 UTC 时区?

web-scraping - 如何在 BeautifulSoup 中只获取标签的内部文本,不包括嵌入的?