Registry / auth-security / stups-tokens

stups-tokens

JSON →
library1.1.19pypypi✓ verified 79d ago

Python library to manage OAuth access tokens, primarily used within the STUPS infrastructure by Zalando. It retrieves tokens from a token service via OAuth2 client credentials flow. Latest version 1.1.19; no longer actively maintained.

pip install stups-tokens
INSTALL
IMPORT
SIG · STUPS-TOKENS
S
stups-tokens
auth-securitypythonv1.1.19
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tokens
from tokens import TOKENS
from stups_tokens import Tokens
get
from tokens import get
from stups_tokens import get
configure
from tokens import configure
from stups_tokens import configure

Retrieve an OAuth2 token for a service using environment variables for configuration.

import os from stups_tokens import Tokens tokens = Tokens( url=os.environ.get('OAUTH2_ACCESS_TOKEN_URL', ''), client_id=os.environ.get('CLIENT_ID', ''), client_secret=os.environ.get('CLIENT_SECRET', ''), realm='services', scope='uid' ) token = tokens.get('myservice') print(token)
tokens --version
Debug
Known issues
gotchaThe library expects the token service URL via OAUTH2_ACCESS_TOKEN_URL or OAUTH_ACCESS_TOKEN_URL (fallback). If neither is set, it will silently fail with a confusing error.
fix
Set OAUTH2_ACCESS_TOKEN_URL before instantiation.
affects: all
gotchaToken objects are strings, but get() may return None if token retrieval fails. Not checking for None leads to AttributeError.
fix
Always check if token is not None before use.
affects: all
breakingIn version 1.0.14, the 'ignore_expiration' flag was added. Code written before that version will not have this parameter, causing TypeError if passed.
fix
Upgrade to >=1.0.14 or conditionally pass the flag.
affects: <1.0.14
deprecatedThe library is no longer actively maintained. For new projects, consider alternatives like requests-oauthlib or authlib.
fix
Migrate to a maintained OAuth2 library.
affects: all
Upgrade
Version history
1.1.19latest on PyPI · released Jan 4, 2017
Audit
Dependencies
requestsrequiredHTTP client for token requests
Agent activity
18 hits · last 30 days
node
12
OpenAI (training)
2
Resources
stups-tokens — pip install stups-tokens · libregistry