Skip to main content

AIOAuth Client – OAuth support for Asyncio / Trio libraries.

Tests Status PYPI Version Python Versions

Requirements

  • python >= 3.9

Installation

AIOAuth Client should be installed using pip:

pip install aioauth-client

Usage

# OAuth2
from aioauth_client import GithubClient

github = GithubClient(
    client_id='b6281b6fe88fa4c313e6',
    client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',
)

authorize_url = github.get_authorize_url(scope="user:email")

# ...
# Reload client to authorize_url and get code
# ...

otoken, _ = await github.get_access_token(code)

# Save the token for later use

# ...

github = GithubClient(
    client_id='b6281b6fe88fa4c313e6',
    client_secret='21ff23d9f1cad775daee6a38d230e1ee05b04f7c',
    access_token=otoken,
)

# Or you can use this if you have initilized client already
# github.access_token = otoken

response = await github.request('GET', 'user')
user_info = await response.json()
# OAuth1
from aioauth_client import TwitterClient

twitter = TwitterClient(
    consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',
    consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',
)

request_token, _ = await twitter.get_request_token()

authorize_url = twitter.get_authorize_url(request_token)
print("Open",authorize_url,"in a browser")
# ...
# Reload client to authorize_url and get oauth_verifier
# ...
print("PIN code:")
oauth_verifier = input()
oauth_token, data = await twitter.get_access_token(oauth_verifier)
oauth_token_secret = data.get('oauth_token_secret')

# Save the tokens for later use

# ...

twitter = TwitterClient(
    consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',
    consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',
    oauth_token=oauth_token,
    oauth_token_secret=oauth_token_secret,
)

# Or you can use this if you have initilized client already
# twitter.access_token = oauth_token
# twitter.access_token_secret = oauth_token_secret

timeline = await twitter.request('GET', 'statuses/home_timeline.json')
content = await timeline.read()
print(content)

Example

Run example with command:

make example

Open http://localhost:8080 in your browser.

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/aioauth-client/issues

Contributing

Development of AIOAuth Client happens at: https://github.com/klen/aioauth-client

License

Licensed under a MIT license.

Release files for aioauth-client 0.30.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aioauth-client 0.30.1
File Size Uploaded
aioauth_client-0.30.1.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aioauth-client 0.30.1
File Interpreter ABI Platform
aioauth_client-0.30.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.9 kB

Release files / aioauth_client-0.30.1.tar.gz

Download URL aioauth_client-0.30.1.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
718b1f7f2030254902d7cad7f4980ae5b0b56755d2c3be7f6befef406948d425
BLAKE2b-256 checksum
How to use checksums
31a5423a175b41e9aa811a58defa566e9f9f7e3a76e060881ab19db426edb646
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure

Release files / aioauth_client-0.30.1-py3-none-any.whl

Download URL aioauth_client-0.30.1-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
806df0ddd31923952eaf8203bcdf1703331098a59a62e02640321e22c0c00015
BLAKE2b-256 checksum
How to use checksums
f4d22314eebd58b904178dc6ae59a492e729288f40375201a4c96fb40b19d746
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure

Release history Release notifications | RSS feed

This release

0.30.1 This release

2 release files

0.29.0

2 release files

0.28.1

2 release files

0.28.0

2 release files

0.27.4

2 release files

0.27.3

2 release files

0.27.2

2 release files

0.27.1

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.9

2 release files

0.25.6

2 release files

0.25.4

2 release files

0.25.3

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.4

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.21.0

2 release files

0.20.3

2 release files

0.20.2

2 release files

0.20.1

2 release files

0.18.3

2 release files

0.18.2

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page