I wanted to use the function of twitter OAuth on Google App Engine (GAE) and tried to run it with requests_oauthlib, but it didn't work, so that memo
ssl I get the following error
error.log
Can't connect to HTTPS URL because the SSL module is not available
Incorporate ssl module as below
app.yaml
libraries:
- name: ssl
version: latest
socket When I import the ssl module, I get the following error. I haven't actually tried it, but this doesn't seem to happen in a production environment.
error.log
must be _socket.socket, not socket
Add _ssl & _socket to _WHITE_LIST_C_MODULES in sandbox.py as below
sandbox.py.diff
$ diff /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py_orig
912,913d911
< '_ssl',
< '_socket',
Overwrite python standard socket.py with GAE socket.py
$ cp /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist27/socket.py /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist27/socket.py_orig
$ cp /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist27/socket.py
Reinsert the requests module
$ pip uninstall requests
$ pip install requests==2.3
Now it's moving.
http://tsuboi-sj.hatenablog.com/entry/2015/05/29/164743 https://stackoverflow.com/questions/16192916/importerror-no-module-named-ssl-with-dev-appserver-py-from-google-app-engine/16937668#16937668