Skip to main content

OpenRelik API Client

This Python package provides a simple API client (APIClient) that automatically handles token refresh on 401 (Unauthorized) responses.

  • Automatic token refresh: Seamlessly refreshes expired access tokens using a refresh token.
  • Easy-to-use interface: Simple methods for common HTTP requests (GET, POST, PUT, DELETE).
  • Customizable: Allows you to specify the API server URL, API key, and API version.

Installation

pip install openrelik-api-client

Example:

 import os
 from openrelik_api_client.api_client import APIClient

 # Initialize the API client
 api_server_url = "http://localhost:8710"

 # API key from environment variable
 api_key = os.getenv("OPENRELIK_API_KEY")

 # Create the API client. It will handle token refreshes automatically.
 api_client = APIClient(api_server_url, api_key)

 # Example GET request
 response = api_client.get("/users/me/")
 print(response.json())

How it works:

The APIClient utilizes a custom session class (TokenRefreshSession) that intercepts requests and checks for 401 responses. If a 401 response is encountered, it automatically attempts to refresh the access token using the provided refresh token. If the refresh is successful, the original request is retried with the new access token.

Obligatory Fine Print

This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.

Metadata

Release files for openrelik-api-client 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openrelik-api-client 0.5.0
File Size Uploaded Provenance
openrelik_api_client-0.5.0.tar.gz 11.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openrelik-api-client 0.5.0
File Interpreter ABI Platform
openrelik_api_client-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / openrelik_api_client-0.5.0.tar.gz

Download URL openrelik_api_client-0.5.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e6985a52c88ff6277bb15332aef4c6f40ba33b0cb7b889754386f9dfa678bc3a
BLAKE2b-256 checksum
How to use checksums
dc5fa4a8a2b258c0f970542f974d07bb196a79bd7855387216781fec657ce491
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.3 Darwin/24.6.0

Release files / openrelik_api_client-0.5.0-py3-none-any.whl

Download URL openrelik_api_client-0.5.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50bc19f5ae3c2c3126bbe72f27983f477230c29dc254eaf32aada59a263c5b92
BLAKE2b-256 checksum
How to use checksums
90c607ab49368c3e1ec91f88942ef3883985052a34fd001623426705940d58f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.3 Darwin/24.6.0

Security for openrelik-api-client 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page