Skip to main content

Annotell Authentication

Project description

Annotell Authentication

Python 3 library providing foundations for Annotell Authentication on top of the requests or httpx libraries.

Install with pip install annotell-auth[requests] or pip install annotell-auth[httpx]

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.

  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 commonly use the AuthSession class which is implements a requests session with automatic token refresh. An httpx implementation is also available.

from annotell.auth.requests.auth_session import RequestsAuthSession

sess = RequestsAuthSession()

# make call to some Annotell service with your token. Use default requests 
sess.get("https://api.annotell.com")

Changelog

2.0.0 (2022-05-02)

Refactor for backend separation, with optional dependencies for either httpx or requests.

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 by requests 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 on FaultTolerantAuthRequestSession
  • 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 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.

Source Distribution

annotell-auth-2.0.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

annotell_auth-2.0.1-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file annotell-auth-2.0.1.tar.gz.

File metadata

  • Download URL: annotell-auth-2.0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/62.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.12

File hashes

Hashes for annotell-auth-2.0.1.tar.gz
Algorithm Hash digest
SHA256 ab673dc8608a9ccd510ae03396e3892a82a8082bb7550e691306e8ca5d7d109e
MD5 53685280ca59269e39c8d47345aadb27
BLAKE2b-256 54764ab1bc8baaf5b8bab3350c197e1598e06667660c42ccb53c8a0de79c1331

See more details on using hashes here.

File details

Details for the file annotell_auth-2.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: annotell_auth-2.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/62.1.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.12

File hashes

Hashes for annotell_auth-2.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1e9bebe3ee3e82bd2936dba621804ca86d02b732bebf0b643a60f81605b3ca62
MD5 5c32530b528d5a8a8be50f210945b82f
BLAKE2b-256 fbb10fb13bd55d0ed2505eebeb8e64e90c3cff66688cf143a3623fed4c851af1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page