Cloudflare client library for kiarina namespace
Project description
kiarina-lib-cloudflare
English | 日本語
[!NOTE] What is this? A package for managing Cloudflare account credentials with pydantic-settings-manager.
Dependencies
| Package | Version | License |
|---|---|---|
| Pydantic Settings | >=2.10.1 |
MIT |
| pydantic-settings-manager | >=3.2.0 |
MIT |
A Cloudflare SDK is not included as a dependency. Add one to the application that uses the credentials.
Installation
pip install kiarina-lib-cloudflare
Features
- Configuring Cloudflare Authentication Store an account ID and API token as typed settings.
- Managing Multiple Accounts Switch between named settings for multiple accounts.
- Loading Environment Variables
Load environment variables with the
KIARINA_LIB_CLOUDFLARE_prefix. - Protecting API Tokens
Store the API token as
SecretStr.
Configuring Cloudflare Authentication
from kiarina.lib.cloudflare import CloudflareSettings
settings = CloudflareSettings(
account_id="0123456789abcdef",
api_token="secret-token",
)
Extract the token where it is needed to create a Cloudflare client.
account_id = settings.account_id
api_token = settings.api_token.get_secret_value()
Managing Multiple Accounts
settings_manager uses multiple-settings mode. Place named settings under configs.
kiarina.lib.cloudflare:
default: production
configs:
development:
account_id: development-account
api_token: development-token
production:
account_id: production-account
api_token: production-token
import yaml
from pydantic_settings_manager import load_user_configs
from kiarina.lib.cloudflare import settings_manager
with open("config.yaml", encoding="utf-8") as file:
load_user_configs(yaml.safe_load(file) or {})
settings = settings_manager.get_settings("production")
To configure only this package directly, assign settings_manager.user_config.
from kiarina.lib.cloudflare import settings_manager
settings_manager.user_config = {
"default": "development",
"configs": {
"development": {
"account_id": "development-account",
"api_token": "development-token",
},
"production": {
"account_id": "production-account",
"api_token": "production-token",
},
},
}
Loading Environment Variables
Load a single configuration from environment variables.
export KIARINA_LIB_CLOUDFLARE_ACCOUNT_ID="0123456789abcdef"
export KIARINA_LIB_CLOUDFLARE_API_TOKEN="secret-token"
from kiarina.lib.cloudflare import CloudflareSettings
settings = CloudflareSettings()
Protecting API Tokens
api_token is a SecretStr. Extract its value explicitly only where required.
api_token = settings.api_token.get_secret_value()
API Reference
kiarina.lib.cloudflare
from kiarina.lib.cloudflare import (
CloudflareSettings,
settings_manager,
)
CloudflareSettings
class CloudflareSettings(BaseSettings):
def __init__(
self,
*,
account_id: str,
api_token: SecretStr,
) -> None: ...
Cloudflare account settings.
Fields
account_id(str): Cloudflare account ID.api_token(SecretStr): Cloudflare API token.
settings_manager
settings_manager: SettingsManager[CloudflareSettings]
Global instance that manages named Cloudflare account settings.
Project details
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 kiarina_lib_cloudflare-2.3.1.tar.gz.
File metadata
- Download URL: kiarina_lib_cloudflare-2.3.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99d162c8eb22d98ab1d6c7a98b094bd638445563f08426d8d18b59a8e179ec2c
|
|
| MD5 |
21d0e08ce1083568ed2927868a3c5311
|
|
| BLAKE2b-256 |
9fe5a58b9d62d28ced963a685799e1069a337eb09c040034d25c7ed05888c695
|
Provenance
The following attestation bundles were made for kiarina_lib_cloudflare-2.3.1.tar.gz:
Publisher:
release-pypi.yml on kiarina/kiarina-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kiarina_lib_cloudflare-2.3.1.tar.gz -
Subject digest:
99d162c8eb22d98ab1d6c7a98b094bd638445563f08426d8d18b59a8e179ec2c - Sigstore transparency entry: 2044312729
- Sigstore integration time:
-
Permalink:
kiarina/kiarina-python@443dbb48340706ef8cf35551de167d64bc11ee82 -
Branch / Tag:
refs/tags/v2.3.1 - Owner: https://github.com/kiarina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@443dbb48340706ef8cf35551de167d64bc11ee82 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kiarina_lib_cloudflare-2.3.1-py3-none-any.whl.
File metadata
- Download URL: kiarina_lib_cloudflare-2.3.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a217d3087f5189ef1a14030bfa071a51ef4d3f8f31548ee1d97417556b12a8d
|
|
| MD5 |
3e5d104e229f8d876e6ca0dc93c80058
|
|
| BLAKE2b-256 |
72f7d5367e6f23fcbfa8e65b5031e867f6cdf17967a83645334269848a0bf6ba
|
Provenance
The following attestation bundles were made for kiarina_lib_cloudflare-2.3.1-py3-none-any.whl:
Publisher:
release-pypi.yml on kiarina/kiarina-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kiarina_lib_cloudflare-2.3.1-py3-none-any.whl -
Subject digest:
7a217d3087f5189ef1a14030bfa071a51ef4d3f8f31548ee1d97417556b12a8d - Sigstore transparency entry: 2044313186
- Sigstore integration time:
-
Permalink:
kiarina/kiarina-python@443dbb48340706ef8cf35551de167d64bc11ee82 -
Branch / Tag:
refs/tags/v2.3.1 - Owner: https://github.com/kiarina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@443dbb48340706ef8cf35551de167d64bc11ee82 -
Trigger Event:
push
-
Statement type: