#NEWLINE# def _make_signature( self , params ) : #NEWLINE# #INDENT# signature = [ ( k . lower ( ) , v ) for ( k , v ) in list ( params . items ( ) ) ] #NEWLINE# signature . sort ( key = ( lambda x : x [ 0 ] ) ) #NEWLINE# pairs = [ ] #NEWLINE# for pair in signature : #NEWLINE# #INDENT# key = urlquote ( str ( pair [ 0 ] ) , safe = '[]' ) #NEWLINE# value = urlquote ( str ( pair [ 1 ] ) , safe = '[]' ) #NEWLINE# item = ( '%s=%s' % ( key , value ) ) #NEWLINE# pairs . append ( signature ) #NEWLINE# #UNINDENT# signature = '&' . join ( pairs ) #NEWLINE# signature = signature . lower ( ) . replace ( '+' , '%20' ) #NEWLINE# signature = hmac . new ( b ( self . key ) , msg = b ( signature ) , digestmod = hashlib . sha1 ) #NEWLINE# return base64 . b64encode ( b ( signature . digest ( ) ) )