Using the Requests python library in Google App Engine

前端 未结 3 1703
执念已碎
执念已碎 2020-12-08 07:37

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

3条回答
  •  囚心锁ツ
    2020-12-08 08:06

    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.

提交回复
热议问题