Kognic Authentication
Project description
Kognic Authentication
Python 3 library providing foundations for Kognic Authentication
on top of the requests
or httpx
libraries.
Install with pip install kognic-auth[requests]
or pip install kognic-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. Kognic Python clients such as in kognic-io
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
KOGNIC_CREDENTIALS
to point to your Api Credentials file. The credentials will contain the Client Id and Client Secret. - Set to the credentials file path like
auth="~/.config/kognic/credentials.json"
- Set environment variables
KOGNIC_CLIENT_ID
andKOGNIC_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 commonly use the AuthSession class which is implements a requests
session with automatic token
refresh. An httpx
implementation is also available.
from kognic.auth.requests.auth_session import RequestsAuthSession
sess = RequestsAuthSession()
# make call to some Kognic service with your token. Use default requests
sess.get("https://api.app.kognic.com")
Changelog
3.0.0 (2022-09-26)
- Rebranded from Annotell to Kognic.
- Dropped deprecated
FaultTolerantAuthRequestSession
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 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
File details
Details for the file kognic-auth-3.0.0.tar.gz
.
File metadata
- Download URL: kognic-auth-3.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30e7c5bdc1a6309edba007a583ead99a0518231c32fbed219bb9324eac33c0d1 |
|
MD5 | bda2b424c167b5ff83aa347f7e1b18a4 |
|
BLAKE2b-256 | 29df92e43c383bc72a8c4530e053bc959612566c5c80a6d97634e50f20050e71 |
File details
Details for the file kognic_auth-3.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: kognic_auth-3.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c57f6265e74c8fb07471837769ca9fcdd22d729777642d3f2c3fb905cb9e571b |
|
MD5 | 855744922fccb2f57632e561261faf1f |
|
BLAKE2b-256 | 5340c6cd68dcb3119829fde4d0f3d959213d1e10454170e36d5ef77acab2381d |