def sign_request():
    from hashlib import sha1
import hmac
key = 'CONSUMER_SECRET&TOKEN_SECRET'
raw = 'BASE_STRING'
hashed = hmac.new(key, raw, sha1)
return hashed.digest().encode('base64').rstrip('\n')
Implementaion HMAC-SHA1 in python