def collect_request_parameters(self, request):
        """Collect parameters in an object for convenient access"""

        class OAuthParameters(object):
            """Used as a parameter container since plain object()s can't"""
            pass

        # Collect parameters
        query = urlparse(request.url.decode("utf-8")).query
        content_type = request.headers.get('Content-Type', '')
        if request.form:
            body = request.form.to_dict()
        elif content_type == 'application/x-www-form-urlencoded':
            body = request.data.decode("utf-8")
        else:
            body = ''
        headers = dict(encode_params_utf8(request.headers.items()))
        params = dict(collect_parameters(uri_query=query, body=body, headers=headers))

        # Extract params and store for convenient and predictable access
        oauth_params = OAuthParameters()
        oauth_params.client_key = params.get(u'oauth_consumer_key')
        oauth_params.resource_owner_key = params.get(u'oauth_token', None)
        oauth_params.nonce = params.get(u'oauth_nonce')
        oauth_params.timestamp = params.get(u'oauth_timestamp')
        oauth_params.verifier = params.get(u'oauth_verifier', None)
        oauth_params.callback_uri = params.get(u'oauth_callback', None)
        oauth_params.realm = params.get(u'realm', None)
        return oauth_params
def collect_request_parameters ( self , request ) : class OAuthParameters ( object ) : pass query = urlparse ( request . url . decode ( "utf-8" ) ) . query content_type = request . headers . get ( 'Content-Type' , '' ) if request . form : body = request . form . to_dict ( ) elif content_type == 'application/x-www-form-urlencoded' : body = request . data . decode ( "utf-8" ) else : body = '' headers = dict ( encode_params_utf8 ( request . headers . items ( ) ) ) params = dict ( collect_parameters ( uri_query = query , body = body , headers = headers ) ) oauth_params = OAuthParameters ( ) oauth_params . client_key = params . get ( u'oauth_consumer_key' ) oauth_params . resource_owner_key = params . get ( u'oauth_token' , None ) oauth_params . nonce = params . get ( u'oauth_nonce' ) oauth_params . timestamp = params . get ( u'oauth_timestamp' ) oauth_params . verifier = params . get ( u'oauth_verifier' , None ) oauth_params . callback_uri = params . get ( u'oauth_callback' , None ) oauth_params . realm = params . get ( u'realm' , None ) return oauth_params
Collect parameters in an object for convenient access