Skip to main content

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.

  1. Set the environment variable ANNOTELL_CREDENTIALS to point to your Annotell Credentials file. The credentials will contain the Client Id and Client Secret.
  2. Set to the credentials file path like auth="~/.config/annotell/credentials.json"
  3. Set environment variables ANNOTELL_CLIENT_ID andANNOTELL_CLIENT_SECRET
  4. 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.6 (2021-02-21)

  • Expose underlying requests.Session on FaultTolerantAuthRequestSession
  • Fix some thread locks

1.5 (2020-10-20)

  • Add FaultTolerantAuthRequestSession that handles token refresh on long running sessions.

1.4 (2020-04-16)

  • Add support for auth parameter, with path to credentials file or AnnotellCredentials object
  • Drop support for legacy API token

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for annotell-auth, version 1.6.1
Filename, size File type Python version Upload date Hashes
Filename, size annotell_auth-1.6.1-py2.py3-none-any.whl (5.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size annotell-auth-1.6.1.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page