/usr/lib/python3/dist-packages/social/backends/tumblr.py is in python3-social-auth 1:0.2.21+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | """
Tumblr OAuth1 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/tumblr.html
"""
from social.utils import first
from social.backends.oauth import BaseOAuth1
class TumblrOAuth(BaseOAuth1):
name = 'tumblr'
ID_KEY = 'name'
AUTHORIZATION_URL = 'http://www.tumblr.com/oauth/authorize'
REQUEST_TOKEN_URL = 'http://www.tumblr.com/oauth/request_token'
REQUEST_TOKEN_METHOD = 'POST'
ACCESS_TOKEN_URL = 'http://www.tumblr.com/oauth/access_token'
def get_user_id(self, details, response):
return response['response']['user'][self.ID_KEY]
def get_user_details(self, response):
# http://www.tumblr.com/docs/en/api/v2#user-methods
user_info = response['response']['user']
data = {'username': user_info['name']}
blog = first(lambda blog: blog['primary'], user_info['blogs'])
if blog:
data['fullname'] = blog['title']
return data
def user_data(self, access_token):
return self.get_json('http://api.tumblr.com/v2/user/info',
auth=self.oauth_auth(access_token))
|