\r
\r
DOUBAN_SERVER = 'www.douban.com'\r
-DOUBAN_REQUEST_TOKEN_URL = 'http://%s/service/auth/request_token' % DOUBAN_SERVER\r
-DOUBAN_ACCESS_TOKEN_URL = 'http://%s/service/auth/access_token' % DOUBAN_SERVER\r
+DOUBAN_REQUEST_TOKEN_URL = 'http://%s/service/auth/request_token' % \\r
+ DOUBAN_SERVER\r
+DOUBAN_ACCESS_TOKEN_URL = 'http://%s/service/auth/access_token' % \\r
+ DOUBAN_SERVER\r
\r
-DOUBAN_AUTHORIZATION_URL = 'http://%s/service/auth/authorize' % DOUBAN_SERVER\r
+DOUBAN_AUTHORIZATION_URL = 'http://%s/service/auth/authorize' % \\r
+ DOUBAN_SERVER\r
\r
\r
class DoubanBackend(OAuthBackend):\r
"""Douban OAuth authentication backend"""\r
name = 'douban'\r
EXTRA_DATA = [('id', 'id')]\r
- \r
+\r
def get_user_id(self, details, response):\r
return response['db:uid']['$t']\r
- \r
+\r
def get_user_details(self, response):\r
"""Return user details from Douban"""\r
return {USERNAME: response["db:uid"]["$t"],\r
url = 'http://api.douban.com/people/%40me?&alt=json'\r
request = self.oauth_request(access_token, url)\r
json = self.fetch_response(request)\r
- \r
+\r
try:\r
return simplejson.loads(json)\r
except ValueError:\r
from oauth2 import Token
from social_auth.utils import setting
-from social_auth.backends import ConsumerBasedOAuth, OAuthBackend, USERNAME,\
- exceptions
+from social_auth.backends import ConsumerBasedOAuth, OAuthBackend, USERNAME, \
+ exceptions
if setting('EVERNOTE_DEBUG', False):
def get_user_id(self, details, response):
"""Use google email or id as unique id"""
- user_id = super(GoogleOAuth2Backend, self).get_user_id(details, response)
+ user_id = super(GoogleOAuth2Backend, self).get_user_id(details,
+ response)
if setting('GOOGLE_OAUTH2_USE_UNIQUE_USER_ID', False):
return response['id']
return user_id