===========
Tornado OAuth 2 Client
---------------------
`tornado-alf` is a OAuth 2 Client base on the tornado's AsyncHTTPClient
Features
--------
* Automatic token retrieving and renewing
* Token expiration control
* Automatic retry on status 401 (UNAUTHORIZED)
Usage
-----
Initialize the client and use it as a AsyncHTTPClient object.
.. code-block:: python
from tornadoalf.client import Client
client = Client(
token_endpoint='http://example.com/token',
client_id='client-id',
client_secret='secret')
resource_uri = 'http://example.com/resource'
response = yield client.fetch(resource_uri,
method='POST', body='{"name": "alf"}',
headers={'Content-Type': 'application/json'})
How it works?
-------------
Before any request the client tries to retrive a token on the endpoint,
expecting a JSON response with the ``access_token`` and ``expires_in`` keys.
The client keeps the token until it is expired, according to the ``expires_in``
value.
After getting the token, the request is issued with a `Bearer authorization
header <http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-7.1>`_:
.. code-block::
GET /resource/1 HTTP/1.1
Host: example.com
Authorization: Bearer token
If the request fails with a 401 (UNAUTHORIZED) status, a new token is retrieved
from the endpoint and the request is retried. This happens only once, if it
fails again the error response is returned.
Troubleshooting
---------------
In case of an error retrieving a token, the error response will be returned,
the real request won't happen.
Related projects
----------------
This project tries to be an adaptaion to tornado of
`alf <https://github.com/globocom/alf>`_
.. |build-status| image:: https://secure.travis-ci.org/globocom/tornado-alf.png?branch=master
:target: https://travis-ci.org/globocom/tornado-alf
Metadata
Release files for tornado-alf 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tornado-alf-0.4.4.tar.gz | 3.8 kB | Without provenance | Details for tornado-alf-0.4.4.tar.gz |
Release files / tornado-alf-0.4.4.tar.gz
| Download URL | tornado-alf-0.4.4.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cd30a5774541b5195144f41a50126c51261c595f5f6364cb00aec4068618ea9
|
|
BLAKE2b-256 checksum How to use checksums |
8dcd082c9328de9ebd2b75962fabc4ce1b271fddaac2c31ccac7b0f027c52d32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for tornado-alf 0.4.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.