I\'m trying to use the awesome Requests library on Google App Engine. I found a patch for urllib3, which requests relies on, that is compatible with App Engine. https://gith
As mentioned, master branch of standalone urllib3 supposedly supports AppEngine now (I'll do a proper PyPI release once someone confirms this fact), but Requests does not yet support AppEngine since it makes assumption about various filesystem things to load configuration files which don't exist on AppEngine. Specifically the error you ran into has to do with loading the ~/.netrc
configuration file.
See Issue #493.
For what it's worth, the equivalent in urllib3 would be:
import urllib3
http = urllib3.PoolManager()
response = http.request('GET', 'someurl')
Update: urllib3 v1.3 was released yesterday which includes AppEngine support.
On Google Appengine (version 1.9.18) requests version 2.3.0 (only!) works IN PRODUCTION (but not on SDK) if you have billing enabled, which enables sockets support.
requests on the Appengine SDK fails with all https:// requests:
ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))
requests version 2.4.1 fails 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 with:
File "distlib/requests/adapters.py", line 415, in send
raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))
Info on sockets support: https://cloud.google.com/appengine/docs/python/sockets/
PS: Replace awsome with very-painful if you intend to use requests on GAE.
See Also: Can Python Requests library be used on Google App Engine?
You can use the latest version of Requests on Google App Engine with the help of requests-toolbelt. This configures Requests to use urllib3's underlying support for App Engine's URLFetch service.