I am using python-social-auth API for authentication in my website. But I am getting an exception `cannot import name is_secure_transport.
Below is the trace.
Django 1.7
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'social.apps.django_app.default',
'login')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
111. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/utils.py" in wrapper
49. backend, uri)
File "/usr/local/lib/python2.7/dist-packages/social/apps/django_app/utils.py" in load_backend
29. Backend = get_backend(BACKENDS, name)
File "/usr/local/lib/python2.7/dist-packages/social/backends/utils.py" in get_backend
51. load_backends(backends, force_load=True)
File "/usr/local/lib/python2.7/dist-packages/social/backends/utils.py" in load_backends
33. backend = module_member(auth_backend)
File "/usr/local/lib/python2.7/dist-packages/social/utils.py" in module_member
23. module = import_module(mod)
File "/usr/local/lib/python2.7/dist-packages/social/utils.py" in import_module
17. __import__(name)
File "/usr/local/lib/python2.7/dist-packages/social/backends/facebook.py" in <module>
12. from social.backends.oauth import BaseOAuth2
File "/usr/local/lib/python2.7/dist-packages/social/backends/oauth.py" in <module>
4. from requests_oauthlib import OAuth1
File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/__init__.py" in <module>
3. from .oauth2_auth import OAuth2
File "/usr/local/lib/python2.7/dist-packages/requests_oauthlib/oauth2_auth.py" in <module>
3. from oauthlib.oauth2 import is_secure_transport
Exception Type: ImportError at /login/google-oauth2/
Exception Value: cannot import name is_secure_transport
Updating the oauthlib version definitely works.
Just do this:
sudo pip install --upgrade oauthlib
you should uninstall tweepy, upgrade oauthlib and then reinstall tweepy as root:
sudo pip uninstall tweepy
sudo pip install oauthlib --upgrade
sudo apt-get install python-tweepy
Had the same problem and this worked fine for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With