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-ams
, or 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 AuthSession
auth_session = AuthSession()
# create a requests session with automatic oauth refresh
sess = auth_session.session
# make call to some Annotell service with your token. Use default requests
sess.get("https://api.annotell.com")
Changelog
1.5
Add FaultTolerantAuthRequestSession that handles token refresh on long running sessions.
1.4
- 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.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77c50e6354354ad282324c9a7a3a0fcf74215c37fad5c6429fa32c9c9d619b9a |
|
MD5 | 2d1f7354cdbd36c02c0e03c9a5b5da99 |
|
BLAKE2b-256 | 2de2e75d5f4eb904af41c8a90db5a5278a82b9a83f21892f39f190b2c6935690 |