我在我的網站中使用python-social-auth API進行身份驗證。 但我得到一個異常`不能導入名稱is_secure_transport。無法導入名稱is_secure_transport
下面是跟蹤。
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
我的猜測是,你可能有一箇舊版本的'oauthlib'嘗試將它升級到0.6.x – karthikr 2014-09-26 04:30:22
thanx @karthikr升級爲我工作...現在得到'HTTPError at/complete/google-oauth2/ 401客戶端錯誤:未經授權的任何想法...... – HadeS 2014-09-28 15:13:13
確保您提供了文檔 – karthikr 2014-09-28 17:35:41