python requests on Google App Engine not working for HTTPS

前端 未结 2 1514
没有蜡笔的小新
没有蜡笔的小新 2020-12-15 21:28

I\'m using python-request on Google App Engine and it\'s not working as expected for HTTPS. Let\'s see an example:

import requests
requests.get(\'https://www         


        
2条回答
  •  半阙折子戏
    2020-12-15 22:07

    There is now a better solution than changing your requests version. As suggested in the official docs you can monkey patch requests to play nicely with Google App Engine.

    First install requests-toolbelt:

    pip install -t lib requests-toolbelt
    

    Then in your main.py file (or equivalent):

    import requests_toolbelt.adapters.appengine
    
    requests_toolbelt.adapters.appengine.monkeypatch()
    

提交回复
热议问题