--- id: requests-auth version: "8.0.0" 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) license_treatment: permissive maintenance: dormant --- # requests-auth — Authentication for Requests License: permissive · Maintenance: dormant · Downloads: 241.2K/mo ## 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 above — 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 pip install requests-auth uv add requests-auth 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_current - Install friction: low - Maintenance: dormant - Downloads: 241.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags oauth2 authentication requests, api key authentication python, ntlm authentication requests, token management requests library, okta authentication python, bearer token requests, multiple auth schemes, oauth2, http-auth, requests-plugin [View on SkillFed](https://skillfed.io/packages/requests-auth) · [View on PyPI](https://pypi.org/project/requests-auth/)