#NEWLINE# def get( self ) : #NEWLINE# #INDENT# request_url = urlparse . urlparse ( self . request . url ) #NEWLINE# callback_url = ( '%s://%s%s' % ( request_url . scheme , request_url . netloc , self . _get_path ( 'callback' ) ) ) #NEWLINE# ( resp , content ) = TWITTER_OAUTH_CLIENT . request ( TWITTER_SERVICE_PROVIDER . request_token_url , 'POST' , body = urllib . urlencode ( { #NEWLINE# #INDENT# 'oauth_callback' : callback_url , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# if ( resp [ 'status' ] != '200' ) : #NEWLINE# #INDENT# self . _write_error ( 400 ) #NEWLINE# self . response . out . write ( ( 'Invalid response requesting temp token: %s\n%s' % ( callback_url [ 'status' ] , content ) ) ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# request_token_response = dict ( parse_qsl ( content ) ) #NEWLINE# #UNINDENT# request_token = request_token_response [ 'oauth_token' ] #NEWLINE# request_token_secret = request_token_response [ 'oauth_token_secret' ] #NEWLINE# request_token_data = data . OAuthToken . create ( token = request_token , secret = request_token_secret ) #NEWLINE# request_token_data . put ( ) #NEWLINE# self . redirect ( ( '%s?oauth_token=%s' % ( TWITTER_SERVICE_PROVIDER . authentication_url , urllib . quote_plus ( request_token ) ) ) )