aioauth-client 0.27.0
pip install aioauth-client==0.27.0
Released:
OAuth support for Asyncio/Trio libraries
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Kirill Klenov
- Tags asyncio, trio, oauth
- Requires: Python >=3.7
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
Project description
AIOAuth Client – OAuth support for Asyncio / Trio libraries.
Requirements
python >= 3.7
Installation
AIOAuth Client should be installed using pip:
pip install aioauth-client
Usage
# OAuth1
from aioauth_client import TwitterClient
twitter = TwitterClient(
consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',
consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',
)
request_token, request_token_secret, _ = 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, oauth_token_secret, _ = await twitter.get_access_token(oauth_verifier)
# 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)
# 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()
Example
Run example with command:
make example
Open http://localhost:5000 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.
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Kirill Klenov
- Tags asyncio, trio, oauth
- Requires: Python >=3.7
Classifiers
- Development Status
- Intended Audience
- License
- Programming Language
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aioauth-client-0.27.0.tar.gz
.
File metadata
- Download URL: aioauth-client-0.27.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2102e0be9d4f00dd81a68258cf63a39cd9a8b15087bd733572ca249efddae775 |
|
MD5 | 5b741ea29cdd13ef01b13c3e1ddc49d2 |
|
BLAKE2b-256 | 4d133ebb5b403c8bfa236062ff5856043e1249bbbe382e83baa9006e9baea000 |
File details
Details for the file aioauth_client-0.27.0-py3-none-any.whl
.
File metadata
- Download URL: aioauth_client-0.27.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1465d27463adc04f19ac110faab19f717a2e50f5fd4ba05247f20e3f0d258cb2 |
|
MD5 | 4f95e5212d12feddcd32f961d960eed1 |
|
BLAKE2b-256 | 29f80b046958ec2188b84643e3e17f9a92731ba3e6e7503678837e6489a7cb77 |