#NEWLINE# def __init__( self , app_key = None , app_secret = None , oauth_token = None , oauth_token_secret = None , headers = None , proxies = None ) : #NEWLINE# #INDENT# self . base_api_url = 'https://api.tumblr.com' #NEWLINE# self . api_version = 'v2' #NEWLINE# self . api_url = ( '%s/%s/' % ( self . base_api_url , self . api_version ) ) #NEWLINE# self . request_token_url = 'https://www.tumblr.com/oauth/request_token' #NEWLINE# self . access_token_url = 'https://www.tumblr.com/oauth/access_token' #NEWLINE# self . authorize_url = 'https://www.tumblr.com/oauth/authorize' #NEWLINE# self . authenticate_url = 'https://www.tumblr.com/oauth/authorize' #NEWLINE# self . default_params = { #NEWLINE# #INDENT# 'api_key' : app_key , #NEWLINE# #UNINDENT# } #NEWLINE# req_headers = { #NEWLINE# #INDENT# 'User-Agent' : ( 'Tumblpy v' + __version__ ) , #NEWLINE# #UNINDENT# } #NEWLINE# if headers : #NEWLINE# #INDENT# req_headers . update ( headers ) #NEWLINE# #UNINDENT# self . app_key = app_key #NEWLINE# self . app_secret = app_secret #NEWLINE# self . oauth_token = oauth_token #NEWLINE# self . oauth_token_secret = oauth_token_secret #NEWLINE# auth = None #NEWLINE# if ( app_secret . app_key and self . app_secret ) : #NEWLINE# #INDENT# if ( ( not self . oauth_token ) and ( not self . oauth_token_secret ) ) : #NEWLINE# #INDENT# auth = OAuth1 ( self . app_key , self . app_secret ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# auth = OAuth1 ( self . app_key , self . app_secret , self . oauth_token , self . oauth_token_secret ) #NEWLINE# #UNINDENT# #UNINDENT# self . client = requests . Session ( ) #NEWLINE# self . client . proxies = proxies #NEWLINE# self . client . headers = req_headers #NEWLINE# self . client . auth = auth