Registry / auth-security / requests-hawk

requests-hawk

JSON →
library1.2.1pypypi✓ verified 86d ago

A requests authentication plugin that implements the Hawk HTTP authentication scheme (https://github.com/hueniverse/hawk). Provides request signing and verification for HTTP APIs. Current version 1.2.1, last updated 2019. Maintenance mode, no recent releases.

pip install requests-hawk
INSTALL
IMPORT
SIG · REQUESTS-HAWK
R
requests-hawk
auth-securitypythonv1.2.1
Install
2.2s avg
Import
603ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.636s · 21.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.2s · import 0.570s · 22MB
19MB installed
● package 19MB
Code
Verified usage

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

requests_hawk
from requests_hawk import HawkAuth
from requests_hawk import requests_hawk
The module itself is not a class; import HawkAuth directly

Create a HawkAuth instance with credentials and pass it as the 'auth' parameter to requests.

import requests from requests_hawk import HawkAuth auth = HawkAuth( hawk_credentials={ 'id': 'my-id', 'key': 'my-secret-key', 'algorithm': 'sha256' } ) response = requests.get('https://example.com/api/resource', auth=auth) print(response.status_code)
Debug
Known issues
deprecatedLibrary is in maintenance mode. No active development since 2019. Consider using 'mohawk' directly or 'requests-hawk' as-is.
fix
Monitor for vulnerabilities; for new projects, evaluate using the 'mohawk' library with custom requests auth.
affects: >=1.0.0
gotchaThe hawk_credentials dict must contain 'id', 'key', and 'algorithm'. 'algorithm' defaults to 'sha256' but is recommended to be explicit.
fix
Always include all three keys to avoid confusion.
affects: >=1.0.0
gotchaContent-Type handling changed in v1.1.1 when Content-Type is bytes. Ensure you send headers as strings or use latest version.
fix
Upgrade to >=1.1.1 or ensure Content-Type is a string.
affects: <1.1.1
Errors
Common errors & fixes
ImportError: No module named requests_hawk
Library not installed or environment issue
fix
Run 'pip install requests-hawk' and ensure it's in the same Python environment.
TypeError: __init__() got an unexpected keyword argument 'hawk_credentials'
Incorrect argument name; should be 'hawk_credentials' (singular) not 'hawk_credentials'.
fix
Use 'hawk_credentials' as the parameter name.
mohawk.exceptions.MissingRequiredAttribute: payload can't be blank when hash is required
The request has a body but Content-Type is missing or empty; Hawk requires hash for non-empty payloads.
fix
Ensure requests have a Content-Type header set (e.g., 'Content-Type': 'application/json') when sending data.
Upgrade
Version history
1.2.1latest on PyPI · released May 4, 2023
Audit
Dependencies
requestsrequiredRequired for the Auth class to hook into requests
mohawkrequiredUsed internally for Hawk crypto operations
Agent activity
29 hits · last 30 days
node
26
Amazon
1
OpenAI (training)
1
Resources
requests-hawk — pip install requests-hawk · libregistry