clarity-api-sdk-python 0.2.11__tar.gz → 0.3.19__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.
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/PKG-INFO +45 -1
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/README.md +32 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/pyproject.toml +17 -1
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/clarity_api_sdk_python.egg-info/PKG-INFO +45 -1
- clarity_api_sdk_python-0.3.19/src/clarity_api_sdk_python.egg-info/SOURCES.txt +54 -0
- clarity_api_sdk_python-0.3.19/src/clarity_api_sdk_python.egg-info/requires.txt +25 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/cti/api/__init__.py +1 -0
- clarity_api_sdk_python-0.3.19/src/cti/api/session.py +73 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/cti/logger/logger.py +22 -12
- clarity_api_sdk_python-0.3.19/src/cti/main_api.py +19 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/__init__.py +28 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/altitude_source.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/attitude_source.py +94 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/depth_source.py +86 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/device.py +92 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/device_type.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/final_product.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/hierarchy.py +39 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/layback_algorithm.py +47 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/layback_source.py +68 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/layback_type.py +47 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/organization.py +42 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/platform.py +55 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/platform_type.py +53 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/position_source.py +85 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/processed_altitude.py +52 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/processed_attitude.py +60 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/processed_depth.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/processed_layback.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/processed_position.py +78 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/processed_sidescan_ping.py +68 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/processing_log.py +70 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/project.py +52 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/projection_option.py +42 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_altitude.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_attitude.py +78 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_depth.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_file.py +90 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_file_configuration.py +47 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_layback.py +66 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_position.py +114 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/raw_sidescan_ping.py +67 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/s3.py +51 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/sidescan_ping_source.py +106 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/source.py +49 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/survey.py +70 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/target.py +55 -0
- clarity_api_sdk_python-0.3.19/src/cti/model/tow_system.py +49 -0
- clarity_api_sdk_python-0.2.11/src/clarity_api_sdk_python.egg-info/SOURCES.txt +0 -14
- clarity_api_sdk_python-0.2.11/src/clarity_api_sdk_python.egg-info/requires.txt +0 -12
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/setup.cfg +0 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/clarity_api_sdk_python.egg-info/dependency_links.txt +0 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/clarity_api_sdk_python.egg-info/top_level.txt +0 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/cti/__init__.py +0 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/cti/api/async_client.py +0 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/cti/api/client.py +0 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/cti/logger/__init__.py +0 -0
- {clarity_api_sdk_python-0.2.11 → clarity_api_sdk_python-0.3.19}/src/cti/main.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clarity-api-sdk-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.19
|
|
4
4
|
Summary: A Python SDK to connect to the CTI Clarity API server.
|
|
5
5
|
Author-email: "Chesapeake Technology Inc." <support@chesapeaketech.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/chesapeake-tech/clarity-api-sdk-python
|
|
@@ -14,7 +14,19 @@ Requires-Dist: brotli
|
|
|
14
14
|
Requires-Dist: h2
|
|
15
15
|
Requires-Dist: httpx_auth>=0.23.1
|
|
16
16
|
Requires-Dist: httpx-retries>=0.4.5
|
|
17
|
+
Requires-Dist: pydantic==2.12.3
|
|
17
18
|
Requires-Dist: structlog
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: black==25.9.0; extra == "dev"
|
|
21
|
+
Requires-Dist: build==1.3.0; extra == "dev"
|
|
22
|
+
Requires-Dist: mypy==1.18.2; extra == "dev"
|
|
23
|
+
Requires-Dist: pre-commit==4.3.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pylint==3.3.8; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest==8.4.2; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-asyncio==1.3.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-md==0.2.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-mock==3.15.1; extra == "dev"
|
|
29
|
+
Requires-Dist: twine==6.2.0; extra == "dev"
|
|
18
30
|
Provides-Extra: brotli
|
|
19
31
|
Requires-Dist: httpx[brotli]>=0.28.1; extra == "brotli"
|
|
20
32
|
Provides-Extra: http2
|
|
@@ -76,4 +88,36 @@ logger_a.warning("This is a new warning message from logger_a.")
|
|
|
76
88
|
|
|
77
89
|
logger_b.info("This info message from logger_b should NOT be visible.")
|
|
78
90
|
logger_b.warning("This is warning message from logger_b")
|
|
91
|
+
|
|
92
|
+
# the value will be redacted
|
|
93
|
+
logger_b.info("password", extra={"aws_access_key_id", "AKIAIOSFODNN7EXAMPLE"})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Model
|
|
97
|
+
|
|
98
|
+
Pydantic models.
|
|
99
|
+
|
|
100
|
+
## API
|
|
101
|
+
|
|
102
|
+
### Singleton async client
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
import asyncio
|
|
106
|
+
from cti.api.session import initialize_async_client, close_async_client
|
|
107
|
+
|
|
108
|
+
async def main():
|
|
109
|
+
await initialize_async_client()
|
|
110
|
+
# ... your application logic ...
|
|
111
|
+
await close_async_client()
|
|
112
|
+
|
|
113
|
+
if __name__ == "__main__":
|
|
114
|
+
asyncio.run(main())
|
|
115
|
+
|
|
116
|
+
# In other modules
|
|
117
|
+
from cti.api.session import async_client
|
|
118
|
+
|
|
119
|
+
async def fetch_data():
|
|
120
|
+
if async_client:
|
|
121
|
+
response = await async_client.get(...)
|
|
122
|
+
return response.json()
|
|
79
123
|
```
|
|
@@ -54,4 +54,36 @@ logger_a.warning("This is a new warning message from logger_a.")
|
|
|
54
54
|
|
|
55
55
|
logger_b.info("This info message from logger_b should NOT be visible.")
|
|
56
56
|
logger_b.warning("This is warning message from logger_b")
|
|
57
|
+
|
|
58
|
+
# the value will be redacted
|
|
59
|
+
logger_b.info("password", extra={"aws_access_key_id", "AKIAIOSFODNN7EXAMPLE"})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Model
|
|
63
|
+
|
|
64
|
+
Pydantic models.
|
|
65
|
+
|
|
66
|
+
## API
|
|
67
|
+
|
|
68
|
+
### Singleton async client
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import asyncio
|
|
72
|
+
from cti.api.session import initialize_async_client, close_async_client
|
|
73
|
+
|
|
74
|
+
async def main():
|
|
75
|
+
await initialize_async_client()
|
|
76
|
+
# ... your application logic ...
|
|
77
|
+
await close_async_client()
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
asyncio.run(main())
|
|
81
|
+
|
|
82
|
+
# In other modules
|
|
83
|
+
from cti.api.session import async_client
|
|
84
|
+
|
|
85
|
+
async def fetch_data():
|
|
86
|
+
if async_client:
|
|
87
|
+
response = await async_client.get(...)
|
|
88
|
+
return response.json()
|
|
57
89
|
```
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "clarity-api-sdk-python"
|
|
8
|
-
version = "0.
|
|
8
|
+
version = "0.3.19"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name="Chesapeake Technology Inc.", email="support@chesapeaketech.com" },
|
|
11
11
|
]
|
|
@@ -23,10 +23,23 @@ dependencies = [
|
|
|
23
23
|
"h2",
|
|
24
24
|
"httpx_auth>=0.23.1",
|
|
25
25
|
"httpx-retries>=0.4.5",
|
|
26
|
+
"pydantic==2.12.3",
|
|
26
27
|
"structlog",
|
|
27
28
|
]
|
|
28
29
|
|
|
29
30
|
[project.optional-dependencies]
|
|
31
|
+
dev = [
|
|
32
|
+
"black==25.9.0",
|
|
33
|
+
"build==1.3.0",
|
|
34
|
+
"mypy==1.18.2",
|
|
35
|
+
"pre-commit==4.3.0",
|
|
36
|
+
"pylint==3.3.8",
|
|
37
|
+
"pytest==8.4.2",
|
|
38
|
+
"pytest-asyncio==1.3.0",
|
|
39
|
+
"pytest-md==0.2.0",
|
|
40
|
+
"pytest-mock==3.15.1",
|
|
41
|
+
"twine==6.2.0"
|
|
42
|
+
]
|
|
30
43
|
brotli = ["httpx[brotli]>=0.28.1"]
|
|
31
44
|
http2 = ["httpx[http2]>=0.28.1"]
|
|
32
45
|
|
|
@@ -35,3 +48,6 @@ http2 = ["httpx[http2]>=0.28.1"]
|
|
|
35
48
|
|
|
36
49
|
[tool.setuptools.packages.find]
|
|
37
50
|
where = ["src"]
|
|
51
|
+
|
|
52
|
+
[tool.pylint.main]
|
|
53
|
+
max-line-length = 150
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clarity-api-sdk-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.19
|
|
4
4
|
Summary: A Python SDK to connect to the CTI Clarity API server.
|
|
5
5
|
Author-email: "Chesapeake Technology Inc." <support@chesapeaketech.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/chesapeake-tech/clarity-api-sdk-python
|
|
@@ -14,7 +14,19 @@ Requires-Dist: brotli
|
|
|
14
14
|
Requires-Dist: h2
|
|
15
15
|
Requires-Dist: httpx_auth>=0.23.1
|
|
16
16
|
Requires-Dist: httpx-retries>=0.4.5
|
|
17
|
+
Requires-Dist: pydantic==2.12.3
|
|
17
18
|
Requires-Dist: structlog
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: black==25.9.0; extra == "dev"
|
|
21
|
+
Requires-Dist: build==1.3.0; extra == "dev"
|
|
22
|
+
Requires-Dist: mypy==1.18.2; extra == "dev"
|
|
23
|
+
Requires-Dist: pre-commit==4.3.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pylint==3.3.8; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest==8.4.2; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-asyncio==1.3.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-md==0.2.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-mock==3.15.1; extra == "dev"
|
|
29
|
+
Requires-Dist: twine==6.2.0; extra == "dev"
|
|
18
30
|
Provides-Extra: brotli
|
|
19
31
|
Requires-Dist: httpx[brotli]>=0.28.1; extra == "brotli"
|
|
20
32
|
Provides-Extra: http2
|
|
@@ -76,4 +88,36 @@ logger_a.warning("This is a new warning message from logger_a.")
|
|
|
76
88
|
|
|
77
89
|
logger_b.info("This info message from logger_b should NOT be visible.")
|
|
78
90
|
logger_b.warning("This is warning message from logger_b")
|
|
91
|
+
|
|
92
|
+
# the value will be redacted
|
|
93
|
+
logger_b.info("password", extra={"aws_access_key_id", "AKIAIOSFODNN7EXAMPLE"})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Model
|
|
97
|
+
|
|
98
|
+
Pydantic models.
|
|
99
|
+
|
|
100
|
+
## API
|
|
101
|
+
|
|
102
|
+
### Singleton async client
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
import asyncio
|
|
106
|
+
from cti.api.session import initialize_async_client, close_async_client
|
|
107
|
+
|
|
108
|
+
async def main():
|
|
109
|
+
await initialize_async_client()
|
|
110
|
+
# ... your application logic ...
|
|
111
|
+
await close_async_client()
|
|
112
|
+
|
|
113
|
+
if __name__ == "__main__":
|
|
114
|
+
asyncio.run(main())
|
|
115
|
+
|
|
116
|
+
# In other modules
|
|
117
|
+
from cti.api.session import async_client
|
|
118
|
+
|
|
119
|
+
async def fetch_data():
|
|
120
|
+
if async_client:
|
|
121
|
+
response = await async_client.get(...)
|
|
122
|
+
return response.json()
|
|
79
123
|
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/clarity_api_sdk_python.egg-info/PKG-INFO
|
|
4
|
+
src/clarity_api_sdk_python.egg-info/SOURCES.txt
|
|
5
|
+
src/clarity_api_sdk_python.egg-info/dependency_links.txt
|
|
6
|
+
src/clarity_api_sdk_python.egg-info/requires.txt
|
|
7
|
+
src/clarity_api_sdk_python.egg-info/top_level.txt
|
|
8
|
+
src/cti/__init__.py
|
|
9
|
+
src/cti/main.py
|
|
10
|
+
src/cti/main_api.py
|
|
11
|
+
src/cti/api/__init__.py
|
|
12
|
+
src/cti/api/async_client.py
|
|
13
|
+
src/cti/api/client.py
|
|
14
|
+
src/cti/api/session.py
|
|
15
|
+
src/cti/logger/__init__.py
|
|
16
|
+
src/cti/logger/logger.py
|
|
17
|
+
src/cti/model/__init__.py
|
|
18
|
+
src/cti/model/altitude_source.py
|
|
19
|
+
src/cti/model/attitude_source.py
|
|
20
|
+
src/cti/model/depth_source.py
|
|
21
|
+
src/cti/model/device.py
|
|
22
|
+
src/cti/model/device_type.py
|
|
23
|
+
src/cti/model/final_product.py
|
|
24
|
+
src/cti/model/hierarchy.py
|
|
25
|
+
src/cti/model/layback_algorithm.py
|
|
26
|
+
src/cti/model/layback_source.py
|
|
27
|
+
src/cti/model/layback_type.py
|
|
28
|
+
src/cti/model/organization.py
|
|
29
|
+
src/cti/model/platform.py
|
|
30
|
+
src/cti/model/platform_type.py
|
|
31
|
+
src/cti/model/position_source.py
|
|
32
|
+
src/cti/model/processed_altitude.py
|
|
33
|
+
src/cti/model/processed_attitude.py
|
|
34
|
+
src/cti/model/processed_depth.py
|
|
35
|
+
src/cti/model/processed_layback.py
|
|
36
|
+
src/cti/model/processed_position.py
|
|
37
|
+
src/cti/model/processed_sidescan_ping.py
|
|
38
|
+
src/cti/model/processing_log.py
|
|
39
|
+
src/cti/model/project.py
|
|
40
|
+
src/cti/model/projection_option.py
|
|
41
|
+
src/cti/model/raw_altitude.py
|
|
42
|
+
src/cti/model/raw_attitude.py
|
|
43
|
+
src/cti/model/raw_depth.py
|
|
44
|
+
src/cti/model/raw_file.py
|
|
45
|
+
src/cti/model/raw_file_configuration.py
|
|
46
|
+
src/cti/model/raw_layback.py
|
|
47
|
+
src/cti/model/raw_position.py
|
|
48
|
+
src/cti/model/raw_sidescan_ping.py
|
|
49
|
+
src/cti/model/s3.py
|
|
50
|
+
src/cti/model/sidescan_ping_source.py
|
|
51
|
+
src/cti/model/source.py
|
|
52
|
+
src/cti/model/survey.py
|
|
53
|
+
src/cti/model/target.py
|
|
54
|
+
src/cti/model/tow_system.py
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
httpx>=0.28.1
|
|
2
|
+
brotli
|
|
3
|
+
h2
|
|
4
|
+
httpx_auth>=0.23.1
|
|
5
|
+
httpx-retries>=0.4.5
|
|
6
|
+
pydantic==2.12.3
|
|
7
|
+
structlog
|
|
8
|
+
|
|
9
|
+
[brotli]
|
|
10
|
+
httpx[brotli]>=0.28.1
|
|
11
|
+
|
|
12
|
+
[dev]
|
|
13
|
+
black==25.9.0
|
|
14
|
+
build==1.3.0
|
|
15
|
+
mypy==1.18.2
|
|
16
|
+
pre-commit==4.3.0
|
|
17
|
+
pylint==3.3.8
|
|
18
|
+
pytest==8.4.2
|
|
19
|
+
pytest-asyncio==1.3.0
|
|
20
|
+
pytest-md==0.2.0
|
|
21
|
+
pytest-mock==3.15.1
|
|
22
|
+
twine==6.2.0
|
|
23
|
+
|
|
24
|
+
[http2]
|
|
25
|
+
httpx[http2]>=0.28.1
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Provides a shared, singleton instance of the ClarityApiAsyncClient.
|
|
2
|
+
|
|
3
|
+
This module allows for a single, reusable async client to be initialized
|
|
4
|
+
and accessed throughout the application, promoting connection reuse and
|
|
5
|
+
efficiency. The client should be initialized at application startup
|
|
6
|
+
and closed gracefully on shutdown.
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
# In your main application entry point
|
|
10
|
+
import asyncio
|
|
11
|
+
from cti.api.session import initialize_async_client, close_async_client
|
|
12
|
+
|
|
13
|
+
async def main():
|
|
14
|
+
await initialize_async_client()
|
|
15
|
+
# ... your application logic ...
|
|
16
|
+
await close_async_client()
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
asyncio.run(main())
|
|
20
|
+
|
|
21
|
+
# In other modules
|
|
22
|
+
from cti.api.session import get_async_client
|
|
23
|
+
|
|
24
|
+
async def fetch_data():
|
|
25
|
+
response = await get_async_client().get(...)
|
|
26
|
+
return response.json()
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
# pylint: disable=global-statement, unnecessary-dunder-call
|
|
30
|
+
|
|
31
|
+
from cti.api.async_client import ClarityApiAsyncClient
|
|
32
|
+
|
|
33
|
+
# The singleton instance, initially None.
|
|
34
|
+
async_client: ClarityApiAsyncClient | None = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
async def initialize_async_client() -> None:
|
|
38
|
+
"""Initializes the shared ClarityApiAsyncClient instance.
|
|
39
|
+
|
|
40
|
+
If the client is already initialized, this function does nothing.
|
|
41
|
+
This function should be awaited at application startup.
|
|
42
|
+
"""
|
|
43
|
+
global async_client
|
|
44
|
+
if async_client is None:
|
|
45
|
+
async_client = ClarityApiAsyncClient()
|
|
46
|
+
await async_client.__aenter__()
|
|
47
|
+
|
|
48
|
+
def get_async_client() -> ClarityApiAsyncClient:
|
|
49
|
+
"""Returns the shared ClarityApiAsyncClient instance.
|
|
50
|
+
|
|
51
|
+
If the client is not initialized, this function initializes it first.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
ClarityApiAsyncClient: The shared ClarityApiAsyncClient instance.
|
|
55
|
+
|
|
56
|
+
Raises:
|
|
57
|
+
ValueError: If initialize_async_client() has not been called first.
|
|
58
|
+
"""
|
|
59
|
+
if async_client is None:
|
|
60
|
+
raise ValueError("initialize_async_client() must be called first to initialize client.")
|
|
61
|
+
return async_client
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
async def close_async_client() -> None:
|
|
65
|
+
"""Closes the shared ClarityApiAsyncClient instance.
|
|
66
|
+
|
|
67
|
+
This function should be awaited at application shutdown to ensure
|
|
68
|
+
the underlying connection pool is closed gracefully.
|
|
69
|
+
"""
|
|
70
|
+
global async_client
|
|
71
|
+
if async_client:
|
|
72
|
+
await async_client.__aexit__(None, None, None)
|
|
73
|
+
async_client = None
|
|
@@ -143,7 +143,23 @@ def _secret_redaction_processor(_, __, event_dict):
|
|
|
143
143
|
Returns:
|
|
144
144
|
structlog.typing.EventDict: The processed event dictionary.
|
|
145
145
|
"""
|
|
146
|
-
sensitive_keys =
|
|
146
|
+
sensitive_keys = {
|
|
147
|
+
"access_token",
|
|
148
|
+
"api_key",
|
|
149
|
+
"auth",
|
|
150
|
+
"authorization",
|
|
151
|
+
"aws_access_key_id",
|
|
152
|
+
"aws_secret_access_key",
|
|
153
|
+
"aws_session_token",
|
|
154
|
+
"credentials",
|
|
155
|
+
"key",
|
|
156
|
+
"keycloak_client_id",
|
|
157
|
+
"keycloak_client_secret",
|
|
158
|
+
"password",
|
|
159
|
+
"secret",
|
|
160
|
+
"secretstring",
|
|
161
|
+
"token",
|
|
162
|
+
}
|
|
147
163
|
|
|
148
164
|
def redact_dict(data):
|
|
149
165
|
"""Recursively redact sensitive keys in nested dictionaries.
|
|
@@ -155,22 +171,16 @@ def _secret_redaction_processor(_, __, event_dict):
|
|
|
155
171
|
dict: The redacted dictionary.
|
|
156
172
|
"""
|
|
157
173
|
if isinstance(data, dict):
|
|
158
|
-
|
|
159
|
-
|
|
174
|
+
# Use a copy of items to allow modification during iteration
|
|
175
|
+
for key, value in list(data.items()):
|
|
176
|
+
if key.lower() in sensitive_keys:
|
|
160
177
|
data[key] = "[REDACTED]"
|
|
161
178
|
elif isinstance(value, dict):
|
|
162
179
|
redact_dict(value)
|
|
163
180
|
return data
|
|
164
181
|
|
|
165
|
-
# Redact top-level
|
|
166
|
-
|
|
167
|
-
if key in event_dict:
|
|
168
|
-
event_dict[key] = "[REDACTED]"
|
|
169
|
-
|
|
170
|
-
# Check for nested dictionaries and redact them
|
|
171
|
-
for key, value in event_dict.items():
|
|
172
|
-
if isinstance(value, dict):
|
|
173
|
-
redact_dict(value)
|
|
182
|
+
# Redact top-level and nested keys
|
|
183
|
+
redact_dict(event_dict)
|
|
174
184
|
|
|
175
185
|
return event_dict
|
|
176
186
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Example"""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
|
|
5
|
+
from cti.api.session import get_async_client, close_async_client, initialize_async_client
|
|
6
|
+
|
|
7
|
+
async def main():
|
|
8
|
+
"""Example of using the Clarity API asynchronously
|
|
9
|
+
"""
|
|
10
|
+
try:
|
|
11
|
+
await initialize_async_client()
|
|
12
|
+
client = get_async_client()
|
|
13
|
+
response = await client.get(url="/api/v1/status")
|
|
14
|
+
print(response.json())
|
|
15
|
+
finally:
|
|
16
|
+
await close_async_client()
|
|
17
|
+
|
|
18
|
+
if __name__ == "__main__":
|
|
19
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Pydantic models for CTI objects."""
|
|
2
|
+
|
|
3
|
+
import inspect
|
|
4
|
+
import pkgutil
|
|
5
|
+
from importlib import import_module
|
|
6
|
+
|
|
7
|
+
__all__ = []
|
|
8
|
+
|
|
9
|
+
# Iterate over all modules in the current package
|
|
10
|
+
for loader, name, is_pkg in pkgutil.iter_modules(__path__):
|
|
11
|
+
if not is_pkg:
|
|
12
|
+
# Import the module
|
|
13
|
+
module = import_module(f".{name}", __package__)
|
|
14
|
+
# Find all public classes in the module
|
|
15
|
+
for class_name, class_obj in inspect.getmembers(module, inspect.isclass):
|
|
16
|
+
# Check if the class is defined in this module (not imported)
|
|
17
|
+
# and if it's a public class (doesn't start with an underscore)
|
|
18
|
+
if class_obj.__module__ == module.__name__ and not class_name.startswith(
|
|
19
|
+
"_"
|
|
20
|
+
):
|
|
21
|
+
# Add the class to globals() to make it importable from the package
|
|
22
|
+
globals()[class_name] = class_obj
|
|
23
|
+
# Add the class name to __all__
|
|
24
|
+
if class_name not in __all__:
|
|
25
|
+
__all__.append(class_name) # type: ignore
|
|
26
|
+
|
|
27
|
+
# Sort __all__ for consistency
|
|
28
|
+
__all__.sort() # type: ignore
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Pydantic models for altitude source data."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, ConfigDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AltitudeSourceBase(BaseModel):
|
|
10
|
+
"""Base model for altitude source data.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
input_timezone: Input timezone string.
|
|
14
|
+
start_time: Start timestamp.
|
|
15
|
+
end_time: End timestamp.
|
|
16
|
+
channels: Number of channels.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
input_timezone: str
|
|
20
|
+
start_time: datetime
|
|
21
|
+
end_time: datetime
|
|
22
|
+
channels: int
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AltitudeSourceCreate(AltitudeSourceBase):
|
|
26
|
+
"""Model for creating altitude source data.
|
|
27
|
+
|
|
28
|
+
Attributes:
|
|
29
|
+
device_id: Foreign key reference to Device.
|
|
30
|
+
source_id: Foreign key reference to Source.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
device_id: UUID
|
|
34
|
+
source_id: UUID
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class AltitudeSourceUpdate(BaseModel):
|
|
38
|
+
"""Model for updating altitude source data.
|
|
39
|
+
|
|
40
|
+
Attributes:
|
|
41
|
+
input_timezone: Input timezone string.
|
|
42
|
+
start_time: Start timestamp.
|
|
43
|
+
end_time: End timestamp.
|
|
44
|
+
channels: Number of channels.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
input_timezone: str | None = None
|
|
48
|
+
start_time: datetime | None = None
|
|
49
|
+
end_time: datetime | None = None
|
|
50
|
+
channels: int | None = None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class AltitudeSource(AltitudeSourceBase):
|
|
54
|
+
"""Model for altitude source data with database fields.
|
|
55
|
+
|
|
56
|
+
Attributes:
|
|
57
|
+
altitude_source_id: Unique identifier for the altitude source.
|
|
58
|
+
device_id: Foreign key reference to Device.
|
|
59
|
+
source_id: Foreign key reference to Source.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
altitude_source_id: UUID
|
|
63
|
+
device_id: UUID
|
|
64
|
+
source_id: UUID
|
|
65
|
+
|
|
66
|
+
model_config = ConfigDict(from_attributes=True)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Pydantic models for attitude source data."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, ConfigDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class AttitudeSourceBase(BaseModel):
|
|
10
|
+
"""Base model for attitude source data.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
input_timezone: Input timezone string.
|
|
14
|
+
channels: Number of channels.
|
|
15
|
+
start_time: Start timestamp.
|
|
16
|
+
end_time: End timestamp.
|
|
17
|
+
sample_rate: Sample rate in Hz.
|
|
18
|
+
projection_option: Foreign key reference to ProjectionOption.
|
|
19
|
+
apply_pitch: Whether to apply pitch correction.
|
|
20
|
+
offset_roll: Roll offset value.
|
|
21
|
+
offset_pitch: Pitch offset value.
|
|
22
|
+
offset_heading: Heading offset value.
|
|
23
|
+
offset_time: Time offset value.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
input_timezone: str
|
|
27
|
+
channels: int
|
|
28
|
+
start_time: datetime
|
|
29
|
+
end_time: datetime
|
|
30
|
+
sample_rate: float | None = None
|
|
31
|
+
projection_option: UUID
|
|
32
|
+
apply_pitch: bool | None = None
|
|
33
|
+
offset_roll: float | None = None
|
|
34
|
+
offset_pitch: float | None = None
|
|
35
|
+
offset_heading: float | None = None
|
|
36
|
+
offset_time: float | None = None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class AttitudeSourceCreate(AttitudeSourceBase):
|
|
40
|
+
"""Model for creating attitude source data.
|
|
41
|
+
|
|
42
|
+
Attributes:
|
|
43
|
+
device_id: Foreign key reference to Device.
|
|
44
|
+
source_id: Foreign key reference to Source.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
device_id: UUID
|
|
48
|
+
source_id: UUID
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AttitudeSourceUpdate(BaseModel):
|
|
52
|
+
"""Model for updating attitude source data.
|
|
53
|
+
|
|
54
|
+
Attributes:
|
|
55
|
+
input_timezone: Input timezone string.
|
|
56
|
+
channels: Number of channels.
|
|
57
|
+
start_time: Start timestamp.
|
|
58
|
+
end_time: End timestamp.
|
|
59
|
+
sample_rate: Sample rate in Hz.
|
|
60
|
+
projection_option: Foreign key reference to ProjectionOption.
|
|
61
|
+
apply_pitch: Whether to apply pitch correction.
|
|
62
|
+
offset_roll: Roll offset value.
|
|
63
|
+
offset_pitch: Pitch offset value.
|
|
64
|
+
offset_heading: Heading offset value.
|
|
65
|
+
offset_time: Time offset value.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
input_timezone: str | None = None
|
|
69
|
+
channels: int | None = None
|
|
70
|
+
start_time: datetime | None = None
|
|
71
|
+
end_time: datetime | None = None
|
|
72
|
+
sample_rate: float | None = None
|
|
73
|
+
projection_option: UUID | None = None
|
|
74
|
+
apply_pitch: bool | None = None
|
|
75
|
+
offset_roll: float | None = None
|
|
76
|
+
offset_pitch: float | None = None
|
|
77
|
+
offset_heading: float | None = None
|
|
78
|
+
offset_time: float | None = None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class AttitudeSource(AttitudeSourceBase):
|
|
82
|
+
"""Model for attitude source data with database fields.
|
|
83
|
+
|
|
84
|
+
Attributes:
|
|
85
|
+
attitude_source_id: Unique identifier for the attitude source.
|
|
86
|
+
device_id: Foreign key reference to Device.
|
|
87
|
+
source_id: Foreign key reference to Source.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
attitude_source_id: UUID
|
|
91
|
+
device_id: UUID
|
|
92
|
+
source_id: UUID
|
|
93
|
+
|
|
94
|
+
model_config = ConfigDict(from_attributes=True)
|