#NEWLINE# def get_access_token( self , oauth_verifier , auto_set_token = True ) : #NEWLINE# #INDENT# required = ( self . access_token , self . access_token_secret ) #NEWLINE# if ( not all ( required ) ) : #NEWLINE# #INDENT# raise TwitterClientError ( ( '%s must be initialized with access_token and access_token_secret\n                                     to fetch authorized access token.' % required . __class__ . __name__ ) ) #NEWLINE# #UNINDENT# self . session . _client . client . verifier = to_unicode ( oauth_verifier , 'utf-8' ) #NEWLINE# try : #NEWLINE# #INDENT# token = self . session . fetch_access_token ( self . access_token_url ) #NEWLINE# #UNINDENT# except requests . RequestException as e : #NEWLINE# #INDENT# raise TwitterClientError ( str ( e ) ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# raise TwitterClientError ( 'Reponse does not contain a token.' ) #NEWLINE# #UNINDENT# if auto_set_token : #NEWLINE# #INDENT# self . auto_set_token ( token ) #NEWLINE# #UNINDENT# return JSONObject ( token )