OAuth 1.0 for Requests#

Requests is a very popular HTTP library for Python. Authlib enables OAuth 1.0 for Requests with its OAuth1Session and OAuth1Auth.

OAuth1Session#

The requests integration follows our common guide of OAuth 1 Session. Follow the documentation in OAuth 1 Session instead.

OAuth1Auth#

It is also possible to use OAuth1Auth directly with requests. After we obtained access token from an OAuth 1.0 provider, we can construct an auth instance for requests:

auth = OAuth1Auth(
    client_id='YOUR-CLIENT-ID',
    client_secret='YOUR-CLIENT-SECRET',
    token='oauth_token',
    token_secret='oauth_token_secret',
)
requests.get(url, auth=auth)