

def __call__(self, request):
    nonce = self.generate_nonce()
    timestamp = self.generate_timestamp()
    base = self.get_base_string(request, nonce, timestamp)
    key = (self.encode(self.secret) + '&')
    if self.oauth_token_secret:
        key += self.encode(self.oauth_token_secret)
    digest = hmac.new(port.to_b(key), port.to_b(base), sha1).digest()
    signature = self.encode(base64.b64encode(digest))
    params = self.oauth_params(nonce, timestamp, signature)
    auth = ','.join(('{0}="{1}"'.format(key, val) for (key, val) in sorted(params)))
    header = ('OAuth ' + auth)
    if (request.headers is None):
        request.headers = {
            
        }
    request.headers['Authorization'] = header

dataset/ETHPy150Open ducksboard/libsaas/libsaas/filters/auth.py OAuthRFC5849.__call__/original