skillfed

stups-tokens

Python library to manage OAuth access tokens

stups-tokens v1.1.19 144.2K downloads/30d#11,158 on PyPI14
Permissive license Apache License Version 2.0 Abandoned released

What it is and what it does

stups-tokens is a Python library for managing OAuth 2.0 access tokens, keeping them in memory and automatically refreshing them when they expire. It abstracts away token lifecycle management—you configure it with an OAuth endpoint and token scopes, then call tokens.get() to retrieve a valid token. The library handles expiration transparently, fetching a new token on the next call after expiry.

It supports three modes: fetching tokens from an OAuth 2.0 endpoint (the default), reading pre-generated tokens from files on disk, or injecting tokens via environment variables for local testing. This makes it useful for applications that need to authenticate with multiple OAuth-protected services without manually managing token refresh logic.

Use it for:

  • Manage multiple service tokens with different scopes in a single application.
  • Local development and testing by injecting fixed tokens via environment variables.
  • Read pre-generated credentials from disk for applications running in restricted environments.
  • Automate token refresh for long-running processes that interact with OAuth 2.0-protected services.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Manages OAuth 2.0 access tokens in memory, automatically refreshing expired tokens and optionally reading them from files or environment variables.

No, unless maintaining legacy Python 2.7 or 3.4–3.5 code. The package is abandoned (last release 2017-01-04, last commit 2019-03-19) and targets end-of-life Python versions. For new projects, use a modern OAuth library or your framework's built-in token handling. For existing deployments, evaluate whether migration is feasible.

Install

stups-tokens on PyPI

pip

pip install stups-tokens

uv

uv add stups-tokens

poetry

poetry add stups-tokens

Installing stups-tokens

Before you install

Low install friction with no runtime dependencies. However, the package is abandoned—last release was 2017-01-04 and last commit 2019-03-19. It targets Python 2.7, 3.4, and 3.5, which are all end-of-life. Use only if maintaining legacy code.

License in practice

Licensed under Apache License Version 2.0 (permissive), allowing commercial and private use with minimal restrictions.

Quickstart

import tokens

tokens.configure(url='https://example.com/access_tokens')
tokens.manage('example', ['read', 'write'])
tokens.start()

token = tokens.get('example')

Requires OAUTH2_ACCESS_TOKEN_URL environment variable or explicit url parameter; CREDENTIALS_DIR may be needed depending on configuration mode.

Verify before relying

  • Compatibility with modern Python versions beyond the declared 2.7, 3.4, and 3.5 support.
  • Whether the package works with current OAuth 2.0 provider implementations and token endpoint changes since 2017.
  • Active maintenance or security updates for production use.

Package facts

License Apache License Version 2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 3,509 days since the last release
Last repo commit
First released
Downloads 144,229/month — #11,158 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: stups_tokens-1.1.19-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5

Tags

oauth token managementaccess token refreshoauth2 token cachingbearer token handlercredential management python
oauth2token-managementlegacy

More Security packages