Infilake OpenAPI Authorization SDK for generating HMAC-SHA256 signed headers
Project description
Infilake OpenAPI Auth SDK
Authorization SDK for generating HMAC-SHA256 signed headers.
Installation
Using pip
pip install infilake-openapi-auth
Using uv
# Install uv (if not already installed)
# Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install
uv venv
uv pip install .
# Or install in development mode
uv pip install -e .
Install from source
pip install .
Development Setup with uv
# Create virtual environment with specific Python version
uv venv --python 3.11
# Activate virtual environment
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
# Install with dev dependencies
uv pip install -e ".[dev]"
# Or use uv sync (reads pyproject.toml)
uv sync
# Run tests
uv run pytest
Usage
from infilake_openapi_auth import AuthSDK
# Initialize with your secret key
sdk = AuthSDK("your-secret-key")
# Generate headers for a request
headers = sdk.get_headers("/api/v1/resource", "POST")
print(headers)
# {'X-Timestamp': '20260116T104530Z', 'X-Authorization': 'base64...'}
# Use with requests library
import requests
url = "https://api.example.com/api/v1/resource"
auth_headers = sdk.get_headers("/api/v1/resource", "GET")
response = requests.get(url, headers=auth_headers)
API
AuthSDK(hmac_secret: str)
Initialize the SDK with your HMAC secret key.
sdk.sign(sign_url: str, request_action: str = "GET") -> AuthResult
Generate authorization signature. Returns an AuthResult object with:
x_timestamp: The timestamp used for signingx_authorization: The Base64-encoded HMAC-SHA256 signature
sdk.get_headers(sign_url: str, request_action: str = "GET") -> dict
Generate headers dict ready for HTTP requests. Returns:
{
"X-Timestamp": "...",
"X-Authorization": "..."
}
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infilake_openapi_auth-1.0.0.tar.gz.
File metadata
- Download URL: infilake_openapi_auth-1.0.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b044fdc80d600e2c285d132236901ca63d53ca5f134180d24c2d34e29ff41f2
|
|
| MD5 |
7f891d7d68a36ddd96eb9f19844b43b8
|
|
| BLAKE2b-256 |
5933867832441d01e84dfc5074bdcc26e8fa5a6bbe5a7a5ad932130cd6b85cfd
|
File details
Details for the file infilake_openapi_auth-1.0.0-py3-none-any.whl.
File metadata
- Download URL: infilake_openapi_auth-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2adf11ce40139cea3a65ee912d1a1b1860b044212e57f32e8fbe47f3c6780ea1
|
|
| MD5 |
60b1f8118e3ae578bf1a2290c9f08808
|
|
| BLAKE2b-256 |
c734e094e2c85ff7c3971d7d0ee88de542292ebf24e200eced43ed53dda3afbe
|