def generate_auth_header(consumer_key, timestamp, nonce, signature_type, signature, version='1.0', next=None, token=None, verifier=None):
 params = {'oauth_consumer_key': consumer_key, 'oauth_version': version, 'oauth_nonce': nonce, 'oauth_timestamp': str(timestamp), 'oauth_signature_method': signature_type, 'oauth_signature': signature}
 if (next is not None):
  params['oauth_callback'] = str(next)
 if (token is not None):
  params['oauth_token'] = token
 if (verifier is not None):
  params['oauth_verifier'] = verifier
 pairs = [('%s="%s"' % (k, urllib.quote(v, safe='~'))) for (k, v) in params.iteritems()]
 return ('OAuth %s' % ', '.join(pairs))

def generate_auth_header ( consumer_key , timestamp , nonce , signature_type , signature , version = '1.0' , next = None , token = None , verifier = None ) : params = { 'oauth_consumer_key' : consumer_key , 'oauth_version' : version , 'oauth_nonce' : nonce , 'oauth_timestamp' : str ( timestamp ) , 'oauth_signature_method' : signature_type , 'oauth_signature' : signature } if ( next is not None ) : params [ 'oauth_callback' ] = str ( next ) if ( token is not None ) : params [ 'oauth_token' ] = token if ( verifier is not None ) : params [ 'oauth_verifier' ] = verifier pairs = [ ( '%s="%s"' % ( k , urllib . quote ( v , safe = '~' ) ) ) for ( k , v ) in params . iteritems ( ) ] return ( 'OAuth %s' % ', ' . join ( pairs ) )
builds the authorization header to be sent in the request .