kiarina-lib-cloudflare 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.so
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .ruff_cache/
9
+ .mypy_cache/
10
+ .pytest_cache/
11
+ .coverage
12
+ coverage.xml
13
+ htmlcov/
14
+
15
+ # uv
16
+ .uv_cache/
17
+
18
+ # Virtual environments & config
19
+ .venv/
20
+ .env
21
+
22
+ # OS
23
+ .DS_Store
24
+
25
+ # Project specific
26
+ *.log
27
+ tmp/
28
+ packages/*/test_settings.yaml
29
+
30
+ # Test data
31
+ tests/data/large/
32
+
33
+ # mise tasks (always include)
34
+ !.mise/tasks/
35
+ !.mise/tasks/**
@@ -0,0 +1,7 @@
1
+ {
2
+ "python.testing.pytestArgs": [
3
+ "tests"
4
+ ],
5
+ "python.testing.unittestEnabled": false,
6
+ "python.testing.pytestEnabled": true
7
+ }
@@ -0,0 +1,268 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.0.0] - 2026-06-10
11
+
12
+ ### Changed
13
+ - No changes
14
+
15
+ ## [1.37.0] - 2026-05-27
16
+
17
+ ### Changed
18
+ - No changes
19
+
20
+ ## [1.35.0] - 2026-01-31
21
+
22
+ ### Changed
23
+ - No changes
24
+
25
+ ## [1.34.0] - 2026-01-31
26
+
27
+ ### Changed
28
+ - No changes
29
+
30
+ ## [1.33.1] - 2026-01-31
31
+
32
+ ### Changed
33
+ - No changes
34
+
35
+ ## [1.33.0] - 2026-01-31
36
+
37
+ ### Changed
38
+ - No changes
39
+
40
+ ## [1.32.0] - 2026-01-30
41
+
42
+ ### Changed
43
+ - No changes
44
+
45
+ ## [1.31.1] - 2026-01-29
46
+
47
+ ### Changed
48
+ - No changes
49
+
50
+ ## [1.31.0] - 2026-01-29
51
+
52
+ ### Changed
53
+ - No changes
54
+
55
+ ## [1.30.0] - 2026-01-27
56
+
57
+ ### Changed
58
+ - No changes
59
+
60
+ ## [1.29.0] - 2026-01-16
61
+
62
+ ### Changed
63
+ - No changes
64
+
65
+ ## [1.28.0] - 2026-01-16
66
+
67
+ ### Changed
68
+ - No changes
69
+
70
+ ## [1.27.0] - 2026-01-12
71
+
72
+ ### Changed
73
+ - No changes
74
+
75
+ ## [1.26.0] - 2026-01-09
76
+
77
+ ### Changed
78
+ - No changes
79
+
80
+ ## [1.25.1] - 2026-01-08
81
+
82
+ ### Changed
83
+ - No changes
84
+
85
+ ## [1.25.0] - 2026-01-08
86
+
87
+ ### Changed
88
+ - No changes
89
+
90
+ ## [1.24.0] - 2026-01-08
91
+
92
+ ### Changed
93
+ - No changes
94
+
95
+ ## [1.23.0] - 2026-01-06
96
+
97
+ ### Changed
98
+ - No changes
99
+
100
+ ## [1.22.1] - 2026-01-06
101
+
102
+ ### Changed
103
+ - No changes
104
+
105
+ ## [1.22.0] - 2026-01-05
106
+
107
+ ### Changed
108
+ - No changes
109
+
110
+ ## [1.21.1] - 2026-01-05
111
+
112
+ ### Changed
113
+ - No changes
114
+
115
+ ## [1.21.0] - 2025-12-30
116
+
117
+ ### Changed
118
+ - No changes
119
+
120
+ ## [1.20.1] - 2025-12-25
121
+
122
+ ### Changed
123
+ - No changes
124
+
125
+ ## [1.20.0] - 2025-12-19
126
+
127
+ ### Changed
128
+ - No changes
129
+
130
+ ## [1.19.0] - 2025-12-19
131
+
132
+ ### Changed
133
+ - No changes
134
+
135
+ ## [1.18.2] - 2025-12-17
136
+
137
+ ### Changed
138
+ - No changes
139
+
140
+ ## [1.18.1] - 2025-12-16
141
+
142
+ ### Changed
143
+ - No changes
144
+
145
+ ## [1.18.0] - 2025-12-16
146
+
147
+ ### Changed
148
+ - No changes
149
+
150
+ ## [1.17.0] - 2025-12-15
151
+
152
+ ### Changed
153
+ - No changes
154
+
155
+ ## [1.16.0] - 2025-12-15
156
+
157
+ ### Changed
158
+ - No changes
159
+
160
+ ## [1.15.1] - 2025-12-14
161
+
162
+ ### Changed
163
+ - No changes
164
+
165
+ ## [1.15.0] - 2025-12-13
166
+
167
+ ### Changed
168
+ - No changes
169
+
170
+ ## [1.14.0] - 2025-12-13
171
+
172
+ ### Changed
173
+ - No changes
174
+
175
+ ## [1.13.0] - 2025-12-09
176
+
177
+ ### Changed
178
+ - No changes
179
+
180
+ ## [1.12.0] - 2025-12-05
181
+
182
+ ### Changed
183
+ - No changes
184
+
185
+ ## [1.11.2] - 2025-12-02
186
+
187
+ ### Changed
188
+ - No changes
189
+
190
+ ## [1.11.1] - 2025-12-01
191
+
192
+ ### Changed
193
+ - No changes
194
+
195
+ ## [1.11.0] - 2025-12-01
196
+
197
+ ### Changed
198
+ - Add environment variable prefix `KIARINA_LIB_CLOUDFLARE_` to `CloudflareSettings` for better configuration management
199
+
200
+ ## [1.10.0] - 2025-12-01
201
+
202
+ ### Changed
203
+ - No changes
204
+
205
+ ## [1.9.0] - 2025-11-26
206
+
207
+ ### Changed
208
+ - No changes
209
+
210
+ ## [1.8.0] - 2025-10-24
211
+
212
+ ### Changed
213
+ - No changes
214
+
215
+ ## [1.7.0] - 2025-10-21
216
+
217
+ ### Changed
218
+ - No changes
219
+
220
+ ## [1.6.3] - 2025-10-13
221
+
222
+ ### Changed
223
+ - Updated `pydantic-settings-manager` dependency from `>=2.1.0` to `>=2.3.0`
224
+
225
+ ## [1.6.2] - 2025-10-10
226
+
227
+ ### Changed
228
+ - No changes
229
+
230
+ ## [1.6.1] - 2025-10-10
231
+
232
+ ### Changed
233
+ - No changes
234
+
235
+ ## [1.6.0] - 2025-10-10
236
+
237
+ ### Changed
238
+ - No changes
239
+
240
+ ## [1.5.0] - 2025-10-10
241
+
242
+ ### Changed
243
+ - No changes
244
+
245
+ ## [1.4.0] - 2025-10-09
246
+
247
+ ### Added
248
+ - Initial release of kiarina-lib-cloudflare
249
+ - Cloudflare authentication library with configuration management using pydantic-settings-manager
250
+ - `CloudflareSettings`: Pydantic settings model for Cloudflare authentication
251
+ - `account_id`: Cloudflare account ID (required)
252
+ - `api_token`: Cloudflare API token (required, protected with SecretStr)
253
+ - `settings_manager`: Global settings manager instance with multi-configuration support
254
+ - Type safety with full type hints and Pydantic validation
255
+ - Environment variable configuration support with `KIARINA_LIB_CLOUDFLARE_` prefix
256
+ - Runtime configuration overrides via `cli_args`
257
+ - Multiple named configurations support (e.g., production, staging)
258
+
259
+ ### Security
260
+ - **Enhanced credential protection**: API tokens use `SecretStr` for secure handling
261
+ - Tokens are masked in string representations and logs (displayed as `**********`)
262
+ - Prevents accidental exposure of sensitive data in debug output
263
+ - Access token values explicitly via `.get_secret_value()` method
264
+ - Follows the project-wide security policy for sensitive data
265
+
266
+ ### Dependencies
267
+ - pydantic-settings>=2.10.1
268
+ - pydantic-settings-manager>=2.1.0
@@ -0,0 +1,262 @@
1
+ Metadata-Version: 2.4
2
+ Name: kiarina-lib-cloudflare
3
+ Version: 2.0.0
4
+ Summary: Cloudflare client library for kiarina namespace
5
+ Project-URL: Homepage, https://github.com/kiarina/kiarina-python
6
+ Project-URL: Repository, https://github.com/kiarina/kiarina-python
7
+ Project-URL: Issues, https://github.com/kiarina/kiarina-python/issues
8
+ Project-URL: Changelog, https://github.com/kiarina/kiarina-python/blob/main/packages/kiarina-lib-cloudflare/CHANGELOG.md
9
+ Project-URL: Documentation, https://github.com/kiarina/kiarina-python/tree/main/packages/kiarina-lib-cloudflare#readme
10
+ Author-email: kiarina <kiarinadawa@gmail.com>
11
+ Maintainer-email: kiarina <kiarinadawa@gmail.com>
12
+ License-Expression: MIT
13
+ Keywords: cdn,client,cloud,cloudflare,pydantic,settings
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.12
23
+ Requires-Dist: pydantic-settings-manager>=3.2.0
24
+ Requires-Dist: pydantic-settings>=2.10.1
25
+ Description-Content-Type: text/markdown
26
+
27
+ # kiarina-lib-cloudflare
28
+
29
+ A Python library for Cloudflare authentication with configuration management using pydantic-settings-manager.
30
+
31
+ ## Features
32
+
33
+ - **Configuration Management**: Use `pydantic-settings-manager` for flexible configuration
34
+ - **Type Safety**: Full type hints and Pydantic validation
35
+ - **Secure Credential Handling**: API tokens are protected using `SecretStr`
36
+ - **Multiple Configurations**: Support for multiple named configurations (e.g., different accounts)
37
+ - **Environment Variable Support**: Configure via environment variables with `KIARINA_LIB_CLOUDFLARE_` prefix
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install kiarina-lib-cloudflare
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ### Basic Usage
48
+
49
+ ```python
50
+ from kiarina.lib.cloudflare import CloudflareSettings, settings_manager
51
+
52
+ # Configure Cloudflare authentication
53
+ settings_manager.user_config = {
54
+ "default": {
55
+ "account_id": "your-account-id",
56
+ "api_token": "your-api-token"
57
+ }
58
+ }
59
+
60
+ # Get settings
61
+ settings = settings_manager.settings
62
+ print(f"Account ID: {settings.account_id}")
63
+ print(f"API Token: {settings.api_token.get_secret_value()}") # Access secret value
64
+ ```
65
+
66
+ ### Environment Variable Configuration
67
+
68
+ Configure authentication using environment variables:
69
+
70
+ ```bash
71
+ export KIARINA_LIB_CLOUDFLARE_ACCOUNT_ID="your-account-id"
72
+ export KIARINA_LIB_CLOUDFLARE_API_TOKEN="your-api-token"
73
+ ```
74
+
75
+ ```python
76
+ from kiarina.lib.cloudflare import settings_manager
77
+
78
+ # Settings are automatically loaded from environment variables
79
+ settings = settings_manager.settings
80
+ print(f"Account ID: {settings.account_id}")
81
+ ```
82
+
83
+ ### Multiple Configurations
84
+
85
+ Manage multiple Cloudflare accounts:
86
+
87
+ ```python
88
+ from kiarina.lib.cloudflare import settings_manager
89
+
90
+ # Configure multiple accounts
91
+ settings_manager.user_config = {
92
+ "production": {
93
+ "account_id": "prod-account-id",
94
+ "api_token": "prod-api-token"
95
+ },
96
+ "staging": {
97
+ "account_id": "staging-account-id",
98
+ "api_token": "staging-api-token"
99
+ }
100
+ }
101
+
102
+ # Switch between configurations
103
+ settings_manager.active_key = "production"
104
+ prod_settings = settings_manager.settings
105
+ print(f"Production Account: {prod_settings.account_id}")
106
+
107
+ settings_manager.active_key = "staging"
108
+ staging_settings = settings_manager.settings
109
+ print(f"Staging Account: {staging_settings.account_id}")
110
+ ```
111
+
112
+ ## Configuration
113
+
114
+ This library uses [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager) for flexible configuration management.
115
+
116
+ ### CloudflareSettings
117
+
118
+ The `CloudflareSettings` class provides the following configuration fields:
119
+
120
+ | Field | Type | Required | Description |
121
+ |-------|------|----------|-------------|
122
+ | `account_id` | `str` | Yes | Cloudflare account ID |
123
+ | `api_token` | `SecretStr` | Yes | Cloudflare API token (masked in logs) |
124
+
125
+ ### Environment Variables
126
+
127
+ All settings can be configured via environment variables with the `KIARINA_LIB_CLOUDFLARE_` prefix:
128
+
129
+ ```bash
130
+ # Account ID
131
+ export KIARINA_LIB_CLOUDFLARE_ACCOUNT_ID="your-account-id"
132
+
133
+ # API Token (will be automatically wrapped in SecretStr)
134
+ export KIARINA_LIB_CLOUDFLARE_API_TOKEN="your-api-token"
135
+ ```
136
+
137
+ ### Programmatic Configuration
138
+
139
+ ```python
140
+ from pydantic import SecretStr
141
+ from kiarina.lib.cloudflare import CloudflareSettings, settings_manager
142
+
143
+ # Direct settings object
144
+ settings = CloudflareSettings(
145
+ account_id="your-account-id",
146
+ api_token=SecretStr("your-api-token")
147
+ )
148
+
149
+ # Via settings manager
150
+ settings_manager.user_config = {
151
+ "default": {
152
+ "account_id": "your-account-id",
153
+ "api_token": "your-api-token" # Automatically converted to SecretStr
154
+ }
155
+ }
156
+ ```
157
+
158
+ ### Runtime Overrides
159
+
160
+ ```python
161
+ from kiarina.lib.cloudflare import settings_manager
162
+
163
+ # Override specific settings at runtime
164
+ settings_manager.cli_args = {
165
+ "account_id": "override-account-id"
166
+ }
167
+
168
+ settings = settings_manager.settings
169
+ print(f"Account ID: {settings.account_id}") # Uses overridden value
170
+ ```
171
+
172
+ ## Security
173
+
174
+ ### API Token Protection
175
+
176
+ API tokens are stored using Pydantic's `SecretStr` type, which provides the following security benefits:
177
+
178
+ - **Masked in logs**: Tokens are displayed as `**********` in string representations
179
+ - **Prevents accidental exposure**: Tokens won't appear in debug output or error messages
180
+ - **Explicit access required**: Must use `.get_secret_value()` to access the actual token
181
+
182
+ ```python
183
+ from kiarina.lib.cloudflare import settings_manager
184
+
185
+ settings = settings_manager.settings
186
+
187
+ # Token is masked in string representation
188
+ print(settings) # api_token=SecretStr('**********')
189
+
190
+ # Explicit access to get the actual token
191
+ token = settings.api_token.get_secret_value()
192
+ ```
193
+
194
+ ## API Reference
195
+
196
+ ### CloudflareSettings
197
+
198
+ ```python
199
+ class CloudflareSettings(BaseSettings):
200
+ account_id: str
201
+ api_token: SecretStr
202
+ ```
203
+
204
+ Pydantic settings model for Cloudflare authentication.
205
+
206
+ **Fields:**
207
+ - `account_id` (str): Cloudflare account ID
208
+ - `api_token` (SecretStr): Cloudflare API token (protected)
209
+
210
+ ### settings_manager
211
+
212
+ ```python
213
+ settings_manager: SettingsManager[CloudflareSettings]
214
+ ```
215
+
216
+ Global settings manager instance for Cloudflare authentication.
217
+ See: [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager)
218
+
219
+ ## Development
220
+
221
+ ### Prerequisites
222
+
223
+ - Python 3.12+
224
+
225
+ ### Setup
226
+
227
+ ```bash
228
+ # Clone the repository
229
+ git clone https://github.com/kiarina/kiarina-python.git
230
+ cd kiarina-python
231
+
232
+ # Setup development environment
233
+ mise run setup
234
+ ```
235
+
236
+ ### Running Tests
237
+
238
+ ```bash
239
+ # Run format, lint, type checks and tests
240
+ mise run package kiarina-lib-cloudflare
241
+
242
+ # Coverage report
243
+ mise run package:test kiarina-lib-cloudflare --coverage
244
+ ```
245
+
246
+ ## Dependencies
247
+
248
+ - [pydantic-settings](https://docs.pydantic.dev/latest/concepts/pydantic_settings/) - Settings management
249
+ - [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager) - Advanced settings management
250
+
251
+ ## License
252
+
253
+ This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
254
+
255
+ ## Contributing
256
+
257
+ This is a personal project, but contributions are welcome! Please feel free to submit issues or pull requests.
258
+
259
+ ## Related Projects
260
+
261
+ - [kiarina-python](https://github.com/kiarina/kiarina-python) - The main monorepo containing this package
262
+ - [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager) - Configuration management library used by this package
@@ -0,0 +1,236 @@
1
+ # kiarina-lib-cloudflare
2
+
3
+ A Python library for Cloudflare authentication with configuration management using pydantic-settings-manager.
4
+
5
+ ## Features
6
+
7
+ - **Configuration Management**: Use `pydantic-settings-manager` for flexible configuration
8
+ - **Type Safety**: Full type hints and Pydantic validation
9
+ - **Secure Credential Handling**: API tokens are protected using `SecretStr`
10
+ - **Multiple Configurations**: Support for multiple named configurations (e.g., different accounts)
11
+ - **Environment Variable Support**: Configure via environment variables with `KIARINA_LIB_CLOUDFLARE_` prefix
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install kiarina-lib-cloudflare
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ### Basic Usage
22
+
23
+ ```python
24
+ from kiarina.lib.cloudflare import CloudflareSettings, settings_manager
25
+
26
+ # Configure Cloudflare authentication
27
+ settings_manager.user_config = {
28
+ "default": {
29
+ "account_id": "your-account-id",
30
+ "api_token": "your-api-token"
31
+ }
32
+ }
33
+
34
+ # Get settings
35
+ settings = settings_manager.settings
36
+ print(f"Account ID: {settings.account_id}")
37
+ print(f"API Token: {settings.api_token.get_secret_value()}") # Access secret value
38
+ ```
39
+
40
+ ### Environment Variable Configuration
41
+
42
+ Configure authentication using environment variables:
43
+
44
+ ```bash
45
+ export KIARINA_LIB_CLOUDFLARE_ACCOUNT_ID="your-account-id"
46
+ export KIARINA_LIB_CLOUDFLARE_API_TOKEN="your-api-token"
47
+ ```
48
+
49
+ ```python
50
+ from kiarina.lib.cloudflare import settings_manager
51
+
52
+ # Settings are automatically loaded from environment variables
53
+ settings = settings_manager.settings
54
+ print(f"Account ID: {settings.account_id}")
55
+ ```
56
+
57
+ ### Multiple Configurations
58
+
59
+ Manage multiple Cloudflare accounts:
60
+
61
+ ```python
62
+ from kiarina.lib.cloudflare import settings_manager
63
+
64
+ # Configure multiple accounts
65
+ settings_manager.user_config = {
66
+ "production": {
67
+ "account_id": "prod-account-id",
68
+ "api_token": "prod-api-token"
69
+ },
70
+ "staging": {
71
+ "account_id": "staging-account-id",
72
+ "api_token": "staging-api-token"
73
+ }
74
+ }
75
+
76
+ # Switch between configurations
77
+ settings_manager.active_key = "production"
78
+ prod_settings = settings_manager.settings
79
+ print(f"Production Account: {prod_settings.account_id}")
80
+
81
+ settings_manager.active_key = "staging"
82
+ staging_settings = settings_manager.settings
83
+ print(f"Staging Account: {staging_settings.account_id}")
84
+ ```
85
+
86
+ ## Configuration
87
+
88
+ This library uses [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager) for flexible configuration management.
89
+
90
+ ### CloudflareSettings
91
+
92
+ The `CloudflareSettings` class provides the following configuration fields:
93
+
94
+ | Field | Type | Required | Description |
95
+ |-------|------|----------|-------------|
96
+ | `account_id` | `str` | Yes | Cloudflare account ID |
97
+ | `api_token` | `SecretStr` | Yes | Cloudflare API token (masked in logs) |
98
+
99
+ ### Environment Variables
100
+
101
+ All settings can be configured via environment variables with the `KIARINA_LIB_CLOUDFLARE_` prefix:
102
+
103
+ ```bash
104
+ # Account ID
105
+ export KIARINA_LIB_CLOUDFLARE_ACCOUNT_ID="your-account-id"
106
+
107
+ # API Token (will be automatically wrapped in SecretStr)
108
+ export KIARINA_LIB_CLOUDFLARE_API_TOKEN="your-api-token"
109
+ ```
110
+
111
+ ### Programmatic Configuration
112
+
113
+ ```python
114
+ from pydantic import SecretStr
115
+ from kiarina.lib.cloudflare import CloudflareSettings, settings_manager
116
+
117
+ # Direct settings object
118
+ settings = CloudflareSettings(
119
+ account_id="your-account-id",
120
+ api_token=SecretStr("your-api-token")
121
+ )
122
+
123
+ # Via settings manager
124
+ settings_manager.user_config = {
125
+ "default": {
126
+ "account_id": "your-account-id",
127
+ "api_token": "your-api-token" # Automatically converted to SecretStr
128
+ }
129
+ }
130
+ ```
131
+
132
+ ### Runtime Overrides
133
+
134
+ ```python
135
+ from kiarina.lib.cloudflare import settings_manager
136
+
137
+ # Override specific settings at runtime
138
+ settings_manager.cli_args = {
139
+ "account_id": "override-account-id"
140
+ }
141
+
142
+ settings = settings_manager.settings
143
+ print(f"Account ID: {settings.account_id}") # Uses overridden value
144
+ ```
145
+
146
+ ## Security
147
+
148
+ ### API Token Protection
149
+
150
+ API tokens are stored using Pydantic's `SecretStr` type, which provides the following security benefits:
151
+
152
+ - **Masked in logs**: Tokens are displayed as `**********` in string representations
153
+ - **Prevents accidental exposure**: Tokens won't appear in debug output or error messages
154
+ - **Explicit access required**: Must use `.get_secret_value()` to access the actual token
155
+
156
+ ```python
157
+ from kiarina.lib.cloudflare import settings_manager
158
+
159
+ settings = settings_manager.settings
160
+
161
+ # Token is masked in string representation
162
+ print(settings) # api_token=SecretStr('**********')
163
+
164
+ # Explicit access to get the actual token
165
+ token = settings.api_token.get_secret_value()
166
+ ```
167
+
168
+ ## API Reference
169
+
170
+ ### CloudflareSettings
171
+
172
+ ```python
173
+ class CloudflareSettings(BaseSettings):
174
+ account_id: str
175
+ api_token: SecretStr
176
+ ```
177
+
178
+ Pydantic settings model for Cloudflare authentication.
179
+
180
+ **Fields:**
181
+ - `account_id` (str): Cloudflare account ID
182
+ - `api_token` (SecretStr): Cloudflare API token (protected)
183
+
184
+ ### settings_manager
185
+
186
+ ```python
187
+ settings_manager: SettingsManager[CloudflareSettings]
188
+ ```
189
+
190
+ Global settings manager instance for Cloudflare authentication.
191
+ See: [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager)
192
+
193
+ ## Development
194
+
195
+ ### Prerequisites
196
+
197
+ - Python 3.12+
198
+
199
+ ### Setup
200
+
201
+ ```bash
202
+ # Clone the repository
203
+ git clone https://github.com/kiarina/kiarina-python.git
204
+ cd kiarina-python
205
+
206
+ # Setup development environment
207
+ mise run setup
208
+ ```
209
+
210
+ ### Running Tests
211
+
212
+ ```bash
213
+ # Run format, lint, type checks and tests
214
+ mise run package kiarina-lib-cloudflare
215
+
216
+ # Coverage report
217
+ mise run package:test kiarina-lib-cloudflare --coverage
218
+ ```
219
+
220
+ ## Dependencies
221
+
222
+ - [pydantic-settings](https://docs.pydantic.dev/latest/concepts/pydantic_settings/) - Settings management
223
+ - [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager) - Advanced settings management
224
+
225
+ ## License
226
+
227
+ This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
228
+
229
+ ## Contributing
230
+
231
+ This is a personal project, but contributions are welcome! Please feel free to submit issues or pull requests.
232
+
233
+ ## Related Projects
234
+
235
+ - [kiarina-python](https://github.com/kiarina/kiarina-python) - The main monorepo containing this package
236
+ - [pydantic-settings-manager](https://github.com/kiarina/pydantic-settings-manager) - Configuration management library used by this package
@@ -0,0 +1,42 @@
1
+ [project]
2
+ name = "kiarina-lib-cloudflare"
3
+ version = "2.0.0"
4
+ description = "Cloudflare client library for kiarina namespace"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [
8
+ { name = "kiarina", email = "kiarinadawa@gmail.com" }
9
+ ]
10
+ maintainers = [
11
+ { name = "kiarina", email = "kiarinadawa@gmail.com" }
12
+ ]
13
+ keywords = ["cloudflare", "client", "pydantic", "settings", "cloud", "cdn"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Software Development :: Libraries :: Python Modules",
22
+ "Typing :: Typed",
23
+ ]
24
+ requires-python = ">=3.12"
25
+ dependencies = [
26
+ "pydantic-settings>=2.10.1",
27
+ "pydantic-settings-manager>=3.2.0",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/kiarina/kiarina-python"
32
+ Repository = "https://github.com/kiarina/kiarina-python"
33
+ Issues = "https://github.com/kiarina/kiarina-python/issues"
34
+ Changelog = "https://github.com/kiarina/kiarina-python/blob/main/packages/kiarina-lib-cloudflare/CHANGELOG.md"
35
+ Documentation = "https://github.com/kiarina/kiarina-python/tree/main/packages/kiarina-lib-cloudflare#readme"
36
+
37
+ [build-system]
38
+ requires = ["hatchling"]
39
+ build-backend = "hatchling.build"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/kiarina"]
@@ -0,0 +1,30 @@
1
+ import logging
2
+ from importlib import import_module
3
+ from importlib.metadata import version
4
+ from typing import TYPE_CHECKING
5
+
6
+ if TYPE_CHECKING:
7
+ from .settings import CloudflareSettings, settings_manager
8
+
9
+ __version__ = version("kiarina-lib-cloudflare")
10
+
11
+ __all__ = [
12
+ # .settings
13
+ "CloudflareSettings",
14
+ "settings_manager",
15
+ ]
16
+
17
+ logging.getLogger(__name__).addHandler(logging.NullHandler())
18
+
19
+
20
+ def __getattr__(name: str) -> object:
21
+ if name not in __all__:
22
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
23
+
24
+ module_map = {
25
+ "CloudflareSettings": ".settings",
26
+ "settings_manager": ".settings",
27
+ }
28
+
29
+ globals()[name] = getattr(import_module(module_map[name], __name__), name)
30
+ return globals()[name]
@@ -0,0 +1,14 @@
1
+ from pydantic import SecretStr
2
+ from pydantic_settings import BaseSettings, SettingsConfigDict
3
+ from pydantic_settings_manager import SettingsManager
4
+
5
+
6
+ class CloudflareSettings(BaseSettings):
7
+ model_config = SettingsConfigDict(env_prefix="KIARINA_LIB_CLOUDFLARE_")
8
+
9
+ account_id: str
10
+
11
+ api_token: SecretStr
12
+
13
+
14
+ settings_manager = SettingsManager(CloudflareSettings, multi=True)
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ from kiarina.lib.cloudflare import settings_manager
2
+
3
+
4
+ def test_settings():
5
+ settings_manager.user_config = {
6
+ "configs": {
7
+ "default": {
8
+ "account_id": "test",
9
+ "api_token": "testtoken",
10
+ }
11
+ }
12
+ }
13
+ settings = settings_manager.settings
14
+ assert settings.account_id == "test"
15
+ assert settings.api_token.get_secret_value() == "testtoken"