本文介绍了可以在 Google App Engine 上使用 Python 请求库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 Google App Engine 上使用请求吗?我认为这个库非常适合创建 REST 客户端.

Can I use Requests on Google App Engine? I think this library is perfect to create a REST client.

推荐答案

是的.在 Google Appengine(1.9.18 版)上 requests version 2.3.0 适用于生产(但不是在 SDK 上)如果您启用了计费,这将启用套接字支持.

Yes. On Google Appengine (version 1.9.18) requests version 2.3.0 works IN PRODUCTION (but not on SDK) if you have billing enabled, which enables sockets support.

更新:截至 2017 年 1 月 31 日,Requests 已投入生产,2.9.1 版已投入生产.但是,它不适用于 Google Cloud SDK 141.0.0

Update: As of 31 Jan 2017 Requests is working in production with version 2.9.1 in production. However, it's not working with Google cloud SDK 141.0.0

Appengine SDK 上的请求失败,所有 https://请求:

requests on the Appengine SDK fails with all https:// requests:

  ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))

请求版本 2.4.1 在生产中失败:

requests version 2.4.1 fails in production with:

  File "distlib/requests/adapters.py", line 407, in send
    raise ConnectionError(err, request=request)
  ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))

请求版本 2.5.1 在生产中失败:

requests version 2.5.1 fails in production with:

  File "distlib/requests/adapters.py", line 415, in send
    raise ConnectionError(err, request=request)
  ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))

requests 2.3.0 版在生产中工作,但可能会导致 Debians 在 SDK 中删除 SSLv3 支持的问题(requests 2.3.0 带有自己现已过时的 urllib3).作为解决方法,可以删除请求的 urllib3 副本源中包含 PROTOCOL_SSLv3 的行.

requests version 2.3.0 works in production, but may cause problems with Debians removed SSLv3 support in the SDK (requests 2.3.0 comes with its own now outdated urllib3). As workaround it is possible to delete the line containing PROTOCOL_SSLv3 in the source of request's urllib3 copy.

  'module' object has no attribute 'PROTOCOL_SSLv3'

有关套接字支持的信息:https://cloud.google.com/appengine/文档/python/sockets/

Info on sockets support: https://cloud.google.com/appengine/docs/python/sockets/

这篇关于可以在 Google App Engine 上使用 Python 请求库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 19:26