Source

pyoauth1client / oauth1client / requests.py

import requests.auth
from oauth1client import Request

class OAuth1(requests.auth.AuthBase):
    def __init__(self, cred):
        self.cred = cred
    def __call__(self, x):
        if x.files:
            data = {}
            replace_data = False 
        else:
            replace_data = True
            data = x.data
        y = Request(x.method, x.full_url, data, x.headers, x.cookies)
        y = self.cred.oauth_req(y)
        x.method = y.method
        x.url = y.url
        if replace_data: 
            x.data = y.data
        x.headers.update(y.headers)
        x.cookies = y.cookies
        return x