#NEWLINE# def sign( self , request , consumer , token ) : #NEWLINE# #INDENT# 'Builds the base signature string.' #NEWLINE# ( key , raw ) = self . signing_base ( request , consumer , token ) #NEWLINE# try : #NEWLINE# #INDENT# from hashlib import sha1 as sha #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# import sha #NEWLINE# #UNINDENT# hashed = hmac . new ( key , raw , sha ) #NEWLINE# return binascii . b2a_base64 ( hashed . digest ( ) ) [ : ( - 1 ) ]