1👍
UPDATE: the original answer (starting with ‘HOWEVER’) is no longer necessary, just use requests
2.10.0 or above, urllib3
1.15.1 or above, and requests_toolbelt
0.6.2 or above and perform the following in your main():
from requests_toolbelt.adapters import appengine
appengine.monkeypatch()
HOWEVER if you’re using older versions of requests and/or urllib3, then you need the patches below:
This can be accomplished using a patched version of requests
along with the requests-toolbelt
package. Threads that apply:
- HTTPS not working on Google App Engine #1905
- urllib3 / Contrib Modules / Google App Engine
- Fixes the AppEngineManager to work within the requests framework #763
- Add AppEngineAdapter for GAE users #114
- Adds a monkeypatch() function that ensures all Sessions use the AppEngineAdapter compatibility class. #119
I’ve applied all of this and now have python-social-auth
and facebook-sdk
working in both local test (the dev server) and production (full App Engine).
1👍
It happens because the Facebook SDK depends on the awesome requests
library. However, requests
doesn’t work on Google App Engine since the platform has some restrictions. You have to use their urlfetch
APIs to fetch external contents on Google App Engine.
So yes, the official Facebook SDK won’t work. You have to roll your own solution or find one that works. SimpleAuth
is one of the solution that is known to have worked.
- [Answered ]-Django: Update object from view, with no model or template
- [Answered ]-Django Pillow install on Amazon EC2
- [Answered ]-Function for every a django-model
- [Answered ]-Running a Python function from Ansible script
0👍
In your vendored libraries, ensure that you have requests_toolbelt. (pip install -t lib requests_toolbelt
). Then “monkeypatch” appengine support before python-social-auth ever calls requests. In my project/wsgi.py, I added the following lines:
from requests_toolbelt.adapters import appengine
appengine.monkeypatch()
python-social-auth depends on requests
, so it should also exist in your vendor directory.
You must also ensure you are using requests version >= 2.10.0. This has not been released yet, so you can fake it. Edit lib/requests/__init__.py
so that __build__ = 0x021000
. You also must upgrade the packaged version of urllib3
in the lib/requests/packages/
directory to the latest version.
This is what worked for me.
- [Answered ]-Django select_related join model attributes with a single query
- [Answered ]-'UserForm' object has no attribute 'Cleaned_data'
- [Answered ]-Should I include translation correctness in functional testing?
- [Answered ]-Django admin show who submitted the entry