This project provides first-class OAuth library support for Aiohttp.
Installation
To install requests and async-oauthlib you can use pip:
$ pip install requests Async-OAuthlib
The OAuth 1 workflow
OAuth 1 can seem overly complicated and it sure has its quirks. Luckily, async_oauthlib hides most of these and let you focus at the task at hand.
Accessing protected resources using async_oauthlib is as simple as:
>>> from async_oauthlib import OAuth1Session
>>> twitter = OAuth1Session('client_key',
client_secret='client_secret',
resource_owner_key='resource_owner_key',
resource_owner_secret='resource_owner_secret')
>>> url = 'https://api.twitter.com/1/account/settings.json'
>>> r = twitter.get(url)
Before accessing resources you will need to obtain a few credentials from your provider (e.g. Twitter) and authorization from the user for whom you wish to retrieve resources for. You can read all about this in the full OAuth 1 workflow guide on RTD.
The OAuth 2 workflow
OAuth 2 is generally simpler than OAuth 1 but comes in more flavours. The most common being the Authorization Code Grant, also known as the WebApplication flow.
Fetching a protected resource after obtaining an access token can be extremely simple. However, before accessing resources you will need to obtain a few credentials from your provider (e.g. Google) and authorization from the user for whom you wish to retrieve resources for. You can read all about this in the full OAuth 2 workflow guide on RTD.
>>> from async_oauthlib import OAuth2Session
>>> target = OAuth2Session()
>>> response = await target.request()
History
Metadata
Release files for Async-OAuthlib 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Async-OAuthlib-0.0.9.tar.gz | 533.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Async_OAuthlib-0.0.9-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 555.0 kB
Release files / Async-OAuthlib-0.0.9.tar.gz
| Download URL | Async-OAuthlib-0.0.9.tar.gz |
|---|---|
| Size | 533.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b463a87d3dd9710b53d3db79f9e4d186ab187ef71d65f3852f818a4078e18908
|
|
BLAKE2b-256 checksum How to use checksums |
33fa9c30101767dd711e54ae9dc695cb7b17647ab420b47cfccfd6c1417a8718
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
|
Release files / Async_OAuthlib-0.0.9-py2.py3-none-any.whl
| Download URL | Async_OAuthlib-0.0.9-py2.py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4824da5bdf1b0d50e6dcdeb2556583c8f8b22b490355847c5740cf1dbfccc7eb
|
|
BLAKE2b-256 checksum How to use checksums |
6c3403e8bc7cdf83e4b0b1130cb12ed5b56381a65a020543936c05f146251e91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.4
|