简体   繁体   中英

cannot import name SIGNATURE_HMAC

I am running the django example provided with python-social-auth , and am getting the following 500 server error.

ImportError at /login/bitbucket/
cannot import name SIGNATURE_HMAC
Request Method: GET
Request URL:    http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: ImportError
Exception Value:    
cannot import name SIGNATURE_HMAC
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in  <module>, line 3
Python Executable:  /usr/bin/python
Python Version: 2.7.3

I searched around in Google and StackOverflow and couldnt find any answers. I have just cloned it and havent changed any code. I have both hashlib and hmac libraries installed

[EDIT] I upgraded both oauthlib and requests_oauthlib and the error got replaced by a new one

AttributeError at /login/bitbucket/
'Request' object has no attribute 'body'
Request Method: GET
Request URL:    http://localhost:8000/login/bitbucket/
Django Version: 1.4.4
Exception Type: AttributeError
Exception Value:    
'Request' object has no attribute 'body'
Exception Location: /usr/local/lib/python2.7/dist-packages/requests_oauthlib/core.py in         __call__, line 46
Python Executable:  /usr/bin/python
Python Version: 2.7.3

Just for reference, I solved the issue in the title (came from Google) by reinstalling the oauthlib package via pip.

sudo pip install --upgrade oauthlib

Due to this problem I wasn't able to open Ubuntu Software Center, after upgrading oauthlib everything works normally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM