skillfed

requests-auth

Authentication for Requests

requests-auth v8.0.0 241.2K downloads/30d#8,883 on PyPI39
Permissive license MIT License Copyright (c) 2024 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) DORMANT released

What it is and what it does

requests-auth is a Python library that extends the requests HTTP library with pluggable authentication handlers for OAuth2, API keys, Basic auth, and NTLM. It wraps these authentication schemes into classes that integrate directly with requests' auth parameter, eliminating the need to manually construct headers or manage token lifecycles.

The package supports multiple OAuth2 flows (Authorization Code, PKCE, Client Credentials, Resource Owner Password, Implicit) with built-in support for identity providers like Okta and Microsoft Entra. It handles token caching, automatic refresh, and early expiry detection to prevent token timeouts mid-request. You pass an authentication instance to requests.get() or any other HTTP method, and the library manages credential exchange and header injection transparently.

Use it for:

  • Authenticate requests to Okta or Microsoft Entra protected APIs using OAuth2 Authorization Code flow with automatic token refresh.
  • Add API key authentication to requests by specifying header or query parameter placement without manual header construction.
  • Implement NTLM authentication for Windows-integrated services and corporate proxies.
  • Combine multiple authentication schemes in a single request.
  • Cache and reuse OAuth2 tokens across multiple requests to reduce authentication overhead.

Worth the install?

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

Adds OAuth2, API key, Basic, and NTLM authentication support to the requests library, handling token management and multiple authentication schemes.

Yes. The package is stable, permissively licensed, has low install friction, and solves a common problem—integrating multiple authentication schemes with requests. Dormant maintenance is not a blocker for a feature-complete auth library, but verify that your target OAuth2 provider and requests version are compatible before relying on it for new projects.

Install

requests-auth on PyPI

pip

pip install requests-auth

uv

uv add requests-auth

poetry

poetry add requests-auth

Installing requests-auth

Before you install

Low install friction with a single dependency on requests. Maintenance is dormant—no releases since June 2024—but the package is marked Production/Stable and the repository remains active, suggesting it is feature-complete rather than abandoned.

License in practice

MIT License permits free use, modification, and distribution with minimal restrictions, making it safe for commercial and open-source projects.

Quickstart

import requests
from requests_auth import OAuth2AuthorizationCode

auth = OAuth2AuthorizationCode('https://www.authorization.url', 'https://www.token.url')
requests.get('https://www.example.com', auth=auth)

Verify before relying

  • Whether token cache persistence works reliably across different operating systems and Python versions.
  • Current compatibility with the latest versions of requests and modern OAuth2 provider implementations.
  • Performance characteristics when handling high-frequency token refresh scenarios.

Package facts

License MIT License Copyright (c) 2024 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — requests
Maintenance dormant — 787 days since the last release
Last repo commit
First released
Downloads 241,208/month — #8,883 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: requests_auth-8.0.0-py3-none-any.whl

Keywords: authentication, ntlm, oauth2, okta, aad, entra

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Build Tools

Tags

oauth2 authentication requestsapi key authentication pythonntlm authentication requeststoken management requests libraryokta authentication pythonbearer token requestsmultiple auth schemes
oauth2http-authrequests-plugin

More Build Tools packages