{"id":27427,"library":"stups-tokens","title":"STUPS Tokens","description":"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.","status":"maintenance","version":"1.1.19","language":"python","source_language":"en","source_url":"https://github.com/zalando-stups/python-tokens","tags":["oauth2","tokens","stups","zalando","authentication"],"install":[{"cmd":"pip install stups-tokens","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"HTTP client for token requests","package":"requests","optional":false}],"imports":[{"wrong":"from stups_tokens import Tokens","symbol":"Tokens","correct":"from tokens import TOKENS"},{"wrong":"from stups_tokens import get","symbol":"get","correct":"from tokens import get"},{"wrong":"from stups_tokens import configure","symbol":"configure","correct":"from tokens import configure"}],"quickstart":{"code":"import os\nfrom stups_tokens import Tokens\n\ntokens = Tokens(\n    url=os.environ.get('OAUTH2_ACCESS_TOKEN_URL', ''),\n    client_id=os.environ.get('CLIENT_ID', ''),\n    client_secret=os.environ.get('CLIENT_SECRET', ''),\n    realm='services',\n    scope='uid'\n)\ntoken = tokens.get('myservice')\nprint(token)","lang":"python","description":"Retrieve an OAuth2 token for a service using environment variables for configuration."},"warnings":[{"fix":"Set OAUTH2_ACCESS_TOKEN_URL before instantiation.","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Always check if token is not None before use.","message":"Token objects are strings, but get() may return None if token retrieval fails. Not checking for None leads to AttributeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=1.0.14 or conditionally pass the flag.","message":"In version 1.0.14, the 'ignore_expiration' flag was added. Code written before that version will not have this parameter, causing TypeError if passed.","severity":"breaking","affected_versions":"<1.0.14"},{"fix":"Migrate to a maintained OAuth2 library.","message":"The library is no longer actively maintained. For new projects, consider alternatives like requests-oauthlib or authlib.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.1.19':32 'access':8 'activ':35 'authent':41 'client':27 'credenti':28 'flow':29 'infrastructur':15 'latest':30 'librari':4 'longer':34 'maintain':36 'manag':6 'oauth':7 'oauth2':26,37 'primarili':10 'python':3 'retriev':19 'servic':24 'stup':1,14,39 'token':2,9,20,23,38 'use':11 'version':31 'via':25 'within':12 'zalando':17,40","created_at":"2026-05-01T17:46:11.984211+00:00","updated_at":"2026-05-01T17:46:11.984211+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"tokens","cli_version":"sh: 1: tokens: not found","type":"library","homepage":null,"github":"https://github.com/zalando-stups/python-tokens","docs":null,"changelog":null,"pypi":"https://pypi.org/project/stups-tokens/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}