Annotell Authentication
Project description
Annotell Authentication
Python 3 library providing foundations for Annotell Authentication
on top of the requests
library.
Builds on the standard Oauth 2.0 Client Credentials flow. There are a few ways to provide auth credentials to our api
clients. Annotell Python clients such as in annotell-input-api
accept an auth
parameter that
can be set explicitly or you can omit it and use environment variables.
There are a few ways to set your credentials in auth
.
- Set the environment variable
ANNOTELL_CREDENTIALS
to point to your Annotell Credentials file. The credentials will contain the Client Id and Client Secret. - Set to the credentials file path like
auth="~/.config/annotell/credentials.json"
- Set environment variables
ANNOTELL_CLIENT_ID
andANNOTELL_CLIENT_SECRET
- Set to credentials tuple
auth=(client_id, client_secret)
API clients such as the InputApiClient
accept this auth
parameter.
Under the hood, they all use the AuthSession class which is implements a requests
session with automatic token
refresh.
from annotell.auth.authsession import FaultTolerantAuthRequestSession
sess = FaultTolerantAuthRequestSession()
# make call to some Annotell service with your token. Use default requests
sess.get("https://api.annotell.com")
Changelog
1.8.0 (2022-04-12)
- Initial support for httpx (BETA). Solves refresh token expiry by reset without the
FaultTolerantAuthRequestSession
- The library will be refactored by a breaking 2.0 release, and make the same changes to the requests version.
The
authsession
module backed byrequests
is untouched for now.
1.7.0 (2022-04-11)
- Fix compatibility issue with authlib >= 1.0.0. Resetting the auth session failed, when the refresh token had expired.
1.6.0 (2021-02-21)
- Expose underlying
requests.Session
onFaultTolerantAuthRequestSession
- Fix some thread locks
1.5.0 (2020-10-20)
- Add
FaultTolerantAuthRequestSession
that handles token refresh on long running sessions.
1.4.0 (2020-04-16)
- Add support for
auth
parameter, with path to credentials file orAnnotellCredentials
object - Drop support for legacy API token
Project details
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
Hashes for annotell_auth-1.8.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 558d5b51d531716cc0c1aae4ff0e3403c389935b7dc3cb0a19ed812f62d5256e |
|
MD5 | 9d89c311e4613cc5288ff57fbdcc3c75 |
|
BLAKE2b-256 | 9734f955d611bf07ff35244195aa1889ce20bf1c4b7fc85bfd135623ee0ab97d |