Can Python Requests library be used on Google App Engine?

前端 未结 7 1113
温柔的废话
温柔的废话 2020-11-29 06:01

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

7条回答
  •  天命终不由人
    2020-11-29 06:18

    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.

    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

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

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

    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'))
    

    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 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'
    

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

提交回复
热议问题