chroniclelabs 0.0.8__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.
Files changed (89) hide show
  1. chroniclelabs-0.0.8/LICENSE +21 -0
  2. chroniclelabs-0.0.8/PKG-INFO +241 -0
  3. chroniclelabs-0.0.8/README.md +207 -0
  4. chroniclelabs-0.0.8/pyproject.toml +100 -0
  5. chroniclelabs-0.0.8/src/chroniclelabs/__init__.py +179 -0
  6. chroniclelabs-0.0.8/src/chroniclelabs/_default_clients.py +32 -0
  7. chroniclelabs-0.0.8/src/chroniclelabs/client.py +328 -0
  8. chroniclelabs-0.0.8/src/chroniclelabs/core/__init__.py +127 -0
  9. chroniclelabs-0.0.8/src/chroniclelabs/core/api_error.py +23 -0
  10. chroniclelabs-0.0.8/src/chroniclelabs/core/client_wrapper.py +146 -0
  11. chroniclelabs-0.0.8/src/chroniclelabs/core/datetime_utils.py +70 -0
  12. chroniclelabs-0.0.8/src/chroniclelabs/core/file.py +67 -0
  13. chroniclelabs-0.0.8/src/chroniclelabs/core/force_multipart.py +18 -0
  14. chroniclelabs-0.0.8/src/chroniclelabs/core/http_client.py +940 -0
  15. chroniclelabs-0.0.8/src/chroniclelabs/core/http_response.py +63 -0
  16. chroniclelabs-0.0.8/src/chroniclelabs/core/http_sse/__init__.py +42 -0
  17. chroniclelabs-0.0.8/src/chroniclelabs/core/http_sse/_api.py +455 -0
  18. chroniclelabs-0.0.8/src/chroniclelabs/core/http_sse/_decoders.py +74 -0
  19. chroniclelabs-0.0.8/src/chroniclelabs/core/http_sse/_exceptions.py +7 -0
  20. chroniclelabs-0.0.8/src/chroniclelabs/core/http_sse/_models.py +17 -0
  21. chroniclelabs-0.0.8/src/chroniclelabs/core/jsonable_encoder.py +133 -0
  22. chroniclelabs-0.0.8/src/chroniclelabs/core/logging.py +107 -0
  23. chroniclelabs-0.0.8/src/chroniclelabs/core/parse_error.py +36 -0
  24. chroniclelabs-0.0.8/src/chroniclelabs/core/pydantic_utilities.py +486 -0
  25. chroniclelabs-0.0.8/src/chroniclelabs/core/query_encoder.py +58 -0
  26. chroniclelabs-0.0.8/src/chroniclelabs/core/remove_none_from_dict.py +11 -0
  27. chroniclelabs-0.0.8/src/chroniclelabs/core/request_options.py +40 -0
  28. chroniclelabs-0.0.8/src/chroniclelabs/core/serialization.py +347 -0
  29. chroniclelabs-0.0.8/src/chroniclelabs/discover/__init__.py +4 -0
  30. chroniclelabs-0.0.8/src/chroniclelabs/discover/client.py +341 -0
  31. chroniclelabs-0.0.8/src/chroniclelabs/discover/raw_client.py +903 -0
  32. chroniclelabs-0.0.8/src/chroniclelabs/environment.py +7 -0
  33. chroniclelabs-0.0.8/src/chroniclelabs/errors/__init__.py +68 -0
  34. chroniclelabs-0.0.8/src/chroniclelabs/errors/bad_request_error.py +11 -0
  35. chroniclelabs-0.0.8/src/chroniclelabs/errors/conflict_error.py +11 -0
  36. chroniclelabs-0.0.8/src/chroniclelabs/errors/content_too_large_error.py +11 -0
  37. chroniclelabs-0.0.8/src/chroniclelabs/errors/gateway_timeout_error.py +11 -0
  38. chroniclelabs-0.0.8/src/chroniclelabs/errors/internal_server_error.py +11 -0
  39. chroniclelabs-0.0.8/src/chroniclelabs/errors/not_found_error.py +11 -0
  40. chroniclelabs-0.0.8/src/chroniclelabs/errors/service_unavailable_error.py +11 -0
  41. chroniclelabs-0.0.8/src/chroniclelabs/errors/too_many_requests_error.py +11 -0
  42. chroniclelabs-0.0.8/src/chroniclelabs/errors/unauthorized_error.py +11 -0
  43. chroniclelabs-0.0.8/src/chroniclelabs/errors/unprocessable_entity_error.py +11 -0
  44. chroniclelabs-0.0.8/src/chroniclelabs/errors/unsupported_media_type_error.py +11 -0
  45. chroniclelabs-0.0.8/src/chroniclelabs/events/__init__.py +4 -0
  46. chroniclelabs-0.0.8/src/chroniclelabs/events/client.py +540 -0
  47. chroniclelabs-0.0.8/src/chroniclelabs/events/raw_client.py +1333 -0
  48. chroniclelabs-0.0.8/src/chroniclelabs/links/__init__.py +34 -0
  49. chroniclelabs-0.0.8/src/chroniclelabs/links/client.py +529 -0
  50. chroniclelabs-0.0.8/src/chroniclelabs/links/raw_client.py +1376 -0
  51. chroniclelabs-0.0.8/src/chroniclelabs/links/types/__init__.py +34 -0
  52. chroniclelabs-0.0.8/src/chroniclelabs/links/types/graph_request_direction.py +5 -0
  53. chroniclelabs-0.0.8/src/chroniclelabs/py.typed +0 -0
  54. chroniclelabs-0.0.8/src/chroniclelabs/sdk/__init__.py +4 -0
  55. chroniclelabs-0.0.8/src/chroniclelabs/sdk/client.py +279 -0
  56. chroniclelabs-0.0.8/src/chroniclelabs/sdk/raw_client.py +961 -0
  57. chroniclelabs-0.0.8/src/chroniclelabs/search/__init__.py +4 -0
  58. chroniclelabs-0.0.8/src/chroniclelabs/search/client.py +169 -0
  59. chroniclelabs-0.0.8/src/chroniclelabs/search/raw_client.py +380 -0
  60. chroniclelabs-0.0.8/src/chroniclelabs/timeline/__init__.py +4 -0
  61. chroniclelabs-0.0.8/src/chroniclelabs/timeline/client.py +180 -0
  62. chroniclelabs-0.0.8/src/chroniclelabs/timeline/raw_client.py +309 -0
  63. chroniclelabs-0.0.8/src/chroniclelabs/types/__init__.py +110 -0
  64. chroniclelabs-0.0.8/src/chroniclelabs/types/accepted_response.py +19 -0
  65. chroniclelabs-0.0.8/src/chroniclelabs/types/create_link_response.py +19 -0
  66. chroniclelabs-0.0.8/src/chroniclelabs/types/entity_info.py +28 -0
  67. chroniclelabs-0.0.8/src/chroniclelabs/types/entity_list_response.py +28 -0
  68. chroniclelabs-0.0.8/src/chroniclelabs/types/entity_ref.py +32 -0
  69. chroniclelabs-0.0.8/src/chroniclelabs/types/entity_type_info.py +27 -0
  70. chroniclelabs-0.0.8/src/chroniclelabs/types/entity_type_list_response.py +21 -0
  71. chroniclelabs-0.0.8/src/chroniclelabs/types/error_response.py +69 -0
  72. chroniclelabs-0.0.8/src/chroniclelabs/types/error_response_code.py +23 -0
  73. chroniclelabs-0.0.8/src/chroniclelabs/types/event.py +60 -0
  74. chroniclelabs-0.0.8/src/chroniclelabs/types/event_list_response.py +28 -0
  75. chroniclelabs-0.0.8/src/chroniclelabs/types/event_page.py +33 -0
  76. chroniclelabs-0.0.8/src/chroniclelabs/types/event_result.py +27 -0
  77. chroniclelabs-0.0.8/src/chroniclelabs/types/ingest_request.py +25 -0
  78. chroniclelabs-0.0.8/src/chroniclelabs/types/ingest_response.py +20 -0
  79. chroniclelabs-0.0.8/src/chroniclelabs/types/link_entity_response.py +19 -0
  80. chroniclelabs-0.0.8/src/chroniclelabs/types/media_attachment.py +34 -0
  81. chroniclelabs-0.0.8/src/chroniclelabs/types/pending_entity_ref.py +24 -0
  82. chroniclelabs-0.0.8/src/chroniclelabs/types/signal_request.py +26 -0
  83. chroniclelabs-0.0.8/src/chroniclelabs/types/source_info.py +28 -0
  84. chroniclelabs-0.0.8/src/chroniclelabs/types/source_list_response.py +21 -0
  85. chroniclelabs-0.0.8/src/chroniclelabs/types/source_schema.py +33 -0
  86. chroniclelabs-0.0.8/src/chroniclelabs/types/span_request.py +31 -0
  87. chroniclelabs-0.0.8/src/chroniclelabs/types/status_response.py +19 -0
  88. chroniclelabs-0.0.8/src/chroniclelabs/types/trace_request.py +27 -0
  89. chroniclelabs-0.0.8/src/chroniclelabs/version.py +3 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chronicle-labs.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.1
2
+ Name: chroniclelabs
3
+ Version: 0.0.8
4
+ Summary:
5
+ License: MIT
6
+ Requires-Python: >=3.10,<4.0
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: MacOS
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Operating System :: POSIX
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Provides-Extra: aiohttp
25
+ Requires-Dist: aiohttp (>=3.14.1,<4) ; (python_version >= "3.10") and (extra == "aiohttp")
26
+ Requires-Dist: httpx (>=0.21.2)
27
+ Requires-Dist: httpx-aiohttp (>=0.1.8,<0.2.0) ; (python_version >= "3.10") and (extra == "aiohttp")
28
+ Requires-Dist: pydantic (>=1.9.2)
29
+ Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
30
+ Requires-Dist: typing_extensions (>=4.0.0)
31
+ Project-URL: Repository, https://github.com/chronicle-labs-ai/chronicle-python
32
+ Description-Content-Type: text/markdown
33
+
34
+ # ChronicleLabs Python Library
35
+
36
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fchronicle-labs-ai%2Fchronicle-python)
37
+ [![pypi](https://img.shields.io/pypi/v/chroniclelabs)](https://pypi.python.org/pypi/chroniclelabs)
38
+
39
+ The ChronicleLabs Python library provides convenient access to the ChronicleLabs APIs from Python.
40
+
41
+ ## Table of Contents
42
+
43
+ - [Installation](#installation)
44
+ - [Reference](#reference)
45
+ - [Usage](#usage)
46
+ - [Environments](#environments)
47
+ - [Async Client](#async-client)
48
+ - [Exception Handling](#exception-handling)
49
+ - [Streaming](#streaming)
50
+ - [Advanced](#advanced)
51
+ - [Access Raw Response Data](#access-raw-response-data)
52
+ - [Retries](#retries)
53
+ - [Timeouts](#timeouts)
54
+ - [Custom Client](#custom-client)
55
+ - [Contributing](#contributing)
56
+
57
+ ## Installation
58
+
59
+ ```sh
60
+ pip install chroniclelabs
61
+ ```
62
+
63
+ ## Reference
64
+
65
+ A full reference for this library is available [here](https://github.com/chronicle-labs-ai/chronicle-python/blob/HEAD/./reference.md).
66
+
67
+ ## Usage
68
+
69
+ Instantiate and use the client with the following:
70
+
71
+ ```python
72
+ from chroniclelabs import Chronicle
73
+
74
+ client = Chronicle(
75
+ token="<token>",
76
+ )
77
+
78
+ client.events.ingest_event(
79
+ source="my-agent",
80
+ topic="conversations",
81
+ event_type="message.sent",
82
+ )
83
+ ```
84
+
85
+ ## Environments
86
+
87
+ This SDK allows you to configure different environments for API requests.
88
+
89
+ ```python
90
+ from chroniclelabs import Chronicle
91
+ from chroniclelabs.environment import ChronicleEnvironment
92
+
93
+ client = Chronicle(
94
+ environment=ChronicleEnvironment.PRODUCTION,
95
+ )
96
+ ```
97
+
98
+ ## Async Client
99
+
100
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
101
+
102
+ ```python
103
+ import asyncio
104
+
105
+ from chroniclelabs import AsyncChronicle
106
+
107
+ client = AsyncChronicle(
108
+ token="<token>",
109
+ )
110
+
111
+
112
+ async def main() -> None:
113
+ await client.events.ingest_event(
114
+ source="my-agent",
115
+ topic="conversations",
116
+ event_type="message.sent",
117
+ )
118
+
119
+
120
+ asyncio.run(main())
121
+ ```
122
+
123
+ ## Exception Handling
124
+
125
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
126
+ will be thrown.
127
+
128
+ ```python
129
+ from chroniclelabs.core.api_error import ApiError
130
+
131
+ try:
132
+ client.events.ingest_event(...)
133
+ except ApiError as e:
134
+ print(e.status_code)
135
+ print(e.body)
136
+ ```
137
+
138
+ ## Streaming
139
+
140
+ The SDK supports streaming responses, as well, the response will be a generator that you can loop over.
141
+
142
+ ```python
143
+ from chroniclelabs import Chronicle
144
+
145
+ client = Chronicle(
146
+ token="<token>",
147
+ )
148
+
149
+ client.events.stream_events()
150
+ ```
151
+
152
+ ## Advanced
153
+
154
+ ### Access Raw Response Data
155
+
156
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
157
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
158
+
159
+ ```python
160
+ from chroniclelabs import Chronicle
161
+
162
+ client = Chronicle(...)
163
+ response = client.events.with_raw_response.ingest_event(...)
164
+ print(response.headers) # access the response headers
165
+ print(response.status_code) # access the response status code
166
+ print(response.data) # access the underlying object
167
+ ```
168
+
169
+ ### Retries
170
+
171
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
172
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
173
+ retry limit (default: 2).
174
+
175
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
176
+
177
+ **`legacy`** (current default): retries on
178
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
179
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
180
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
181
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
182
+
183
+ **`recommended`**: retries on
184
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
185
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
186
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
187
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
188
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
189
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
190
+
191
+ Use the `max_retries` request option to configure this behavior.
192
+
193
+ ```python
194
+ client.events.ingest_event(..., request_options={
195
+ "max_retries": 1
196
+ })
197
+ ```
198
+
199
+ ### Timeouts
200
+
201
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
202
+
203
+ ```python
204
+ from chroniclelabs import Chronicle
205
+
206
+ client = Chronicle(..., timeout=20.0)
207
+
208
+ # Override timeout for a specific method
209
+ client.events.ingest_event(..., request_options={
210
+ "timeout": 1
211
+ })
212
+ ```
213
+
214
+ ### Custom Client
215
+
216
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
217
+ and transports.
218
+
219
+ ```python
220
+ import httpx
221
+ from chroniclelabs import Chronicle
222
+
223
+ client = Chronicle(
224
+ ...,
225
+ httpx_client=httpx.Client(
226
+ proxy="http://my.test.proxy.example.com",
227
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
228
+ ),
229
+ )
230
+ ```
231
+
232
+ ## Contributing
233
+
234
+ While we value open-source contributions to this SDK, this library is generated programmatically.
235
+ Additions made directly to this library would have to be moved over to our generation code,
236
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
237
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
238
+ an issue first to discuss with us!
239
+
240
+ On the other hand, contributions to the README are always very welcome!
241
+
@@ -0,0 +1,207 @@
1
+ # ChronicleLabs Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fchronicle-labs-ai%2Fchronicle-python)
4
+ [![pypi](https://img.shields.io/pypi/v/chroniclelabs)](https://pypi.python.org/pypi/chroniclelabs)
5
+
6
+ The ChronicleLabs Python library provides convenient access to the ChronicleLabs APIs from Python.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Environments](#environments)
14
+ - [Async Client](#async-client)
15
+ - [Exception Handling](#exception-handling)
16
+ - [Streaming](#streaming)
17
+ - [Advanced](#advanced)
18
+ - [Access Raw Response Data](#access-raw-response-data)
19
+ - [Retries](#retries)
20
+ - [Timeouts](#timeouts)
21
+ - [Custom Client](#custom-client)
22
+ - [Contributing](#contributing)
23
+
24
+ ## Installation
25
+
26
+ ```sh
27
+ pip install chroniclelabs
28
+ ```
29
+
30
+ ## Reference
31
+
32
+ A full reference for this library is available [here](https://github.com/chronicle-labs-ai/chronicle-python/blob/HEAD/./reference.md).
33
+
34
+ ## Usage
35
+
36
+ Instantiate and use the client with the following:
37
+
38
+ ```python
39
+ from chroniclelabs import Chronicle
40
+
41
+ client = Chronicle(
42
+ token="<token>",
43
+ )
44
+
45
+ client.events.ingest_event(
46
+ source="my-agent",
47
+ topic="conversations",
48
+ event_type="message.sent",
49
+ )
50
+ ```
51
+
52
+ ## Environments
53
+
54
+ This SDK allows you to configure different environments for API requests.
55
+
56
+ ```python
57
+ from chroniclelabs import Chronicle
58
+ from chroniclelabs.environment import ChronicleEnvironment
59
+
60
+ client = Chronicle(
61
+ environment=ChronicleEnvironment.PRODUCTION,
62
+ )
63
+ ```
64
+
65
+ ## Async Client
66
+
67
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
68
+
69
+ ```python
70
+ import asyncio
71
+
72
+ from chroniclelabs import AsyncChronicle
73
+
74
+ client = AsyncChronicle(
75
+ token="<token>",
76
+ )
77
+
78
+
79
+ async def main() -> None:
80
+ await client.events.ingest_event(
81
+ source="my-agent",
82
+ topic="conversations",
83
+ event_type="message.sent",
84
+ )
85
+
86
+
87
+ asyncio.run(main())
88
+ ```
89
+
90
+ ## Exception Handling
91
+
92
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
93
+ will be thrown.
94
+
95
+ ```python
96
+ from chroniclelabs.core.api_error import ApiError
97
+
98
+ try:
99
+ client.events.ingest_event(...)
100
+ except ApiError as e:
101
+ print(e.status_code)
102
+ print(e.body)
103
+ ```
104
+
105
+ ## Streaming
106
+
107
+ The SDK supports streaming responses, as well, the response will be a generator that you can loop over.
108
+
109
+ ```python
110
+ from chroniclelabs import Chronicle
111
+
112
+ client = Chronicle(
113
+ token="<token>",
114
+ )
115
+
116
+ client.events.stream_events()
117
+ ```
118
+
119
+ ## Advanced
120
+
121
+ ### Access Raw Response Data
122
+
123
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
124
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
125
+
126
+ ```python
127
+ from chroniclelabs import Chronicle
128
+
129
+ client = Chronicle(...)
130
+ response = client.events.with_raw_response.ingest_event(...)
131
+ print(response.headers) # access the response headers
132
+ print(response.status_code) # access the response status code
133
+ print(response.data) # access the underlying object
134
+ ```
135
+
136
+ ### Retries
137
+
138
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
139
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
140
+ retry limit (default: 2).
141
+
142
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
143
+
144
+ **`legacy`** (current default): retries on
145
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
146
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
147
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
148
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
149
+
150
+ **`recommended`**: retries on
151
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
152
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
153
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
154
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
155
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
156
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
157
+
158
+ Use the `max_retries` request option to configure this behavior.
159
+
160
+ ```python
161
+ client.events.ingest_event(..., request_options={
162
+ "max_retries": 1
163
+ })
164
+ ```
165
+
166
+ ### Timeouts
167
+
168
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
169
+
170
+ ```python
171
+ from chroniclelabs import Chronicle
172
+
173
+ client = Chronicle(..., timeout=20.0)
174
+
175
+ # Override timeout for a specific method
176
+ client.events.ingest_event(..., request_options={
177
+ "timeout": 1
178
+ })
179
+ ```
180
+
181
+ ### Custom Client
182
+
183
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
184
+ and transports.
185
+
186
+ ```python
187
+ import httpx
188
+ from chroniclelabs import Chronicle
189
+
190
+ client = Chronicle(
191
+ ...,
192
+ httpx_client=httpx.Client(
193
+ proxy="http://my.test.proxy.example.com",
194
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
195
+ ),
196
+ )
197
+ ```
198
+
199
+ ## Contributing
200
+
201
+ While we value open-source contributions to this SDK, this library is generated programmatically.
202
+ Additions made directly to this library would have to be moved over to our generation code,
203
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
204
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
205
+ an issue first to discuss with us!
206
+
207
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,100 @@
1
+ [project]
2
+ name = "chroniclelabs"
3
+ dynamic = ["version"]
4
+
5
+ [tool.poetry]
6
+ name = "chroniclelabs"
7
+ version = "0.0.8"
8
+ description = ""
9
+ readme = "README.md"
10
+ authors = []
11
+ keywords = []
12
+ license = "MIT"
13
+ classifiers = [
14
+ "Intended Audience :: Developers",
15
+ "Programming Language :: Python",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Programming Language :: Python :: 3.15",
23
+ "Operating System :: OS Independent",
24
+ "Operating System :: POSIX",
25
+ "Operating System :: MacOS",
26
+ "Operating System :: POSIX :: Linux",
27
+ "Operating System :: Microsoft :: Windows",
28
+ "Topic :: Software Development :: Libraries :: Python Modules",
29
+ "Typing :: Typed",
30
+ "License :: OSI Approved :: MIT License"
31
+ ]
32
+ packages = [
33
+ { include = "chroniclelabs", from = "src"}
34
+ ]
35
+
36
+ [tool.poetry.urls]
37
+ Repository = 'https://github.com/chronicle-labs-ai/chronicle-python'
38
+
39
+ [tool.poetry.dependencies]
40
+ python = "^3.10"
41
+ aiohttp = { version = ">=3.14.1,<4", optional = true, python = ">=3.10"}
42
+ httpx = ">=0.21.2"
43
+ httpx-aiohttp = { version = "^0.1.8", optional = true, python = ">=3.10"}
44
+ pydantic = ">= 1.9.2"
45
+ pydantic-core = ">=2.18.2,<3.0.0"
46
+ typing_extensions = ">= 4.0.0"
47
+
48
+ [tool.poetry.group.dev.dependencies]
49
+ mypy = "==1.13.0"
50
+ pytest = "^9.0.3"
51
+ pytest-asyncio = "^1.0.0"
52
+ pytest-xdist = "^3.6.1"
53
+ python-dateutil = "^2.9.0"
54
+ types-python-dateutil = "^2.9.0.20240316"
55
+ urllib3 = ">=2.6.3,<3.0.0"
56
+ requests = "^2.33.0"
57
+ types-requests = "^2.33.0"
58
+ ruff = "==0.11.5"
59
+
60
+ [tool.pytest.ini_options]
61
+ testpaths = [ "tests" ]
62
+ asyncio_mode = "auto"
63
+ norecursedirs = [ "src" ]
64
+ markers = [
65
+ "aiohttp: tests that require httpx_aiohttp to be installed",
66
+ ]
67
+
68
+ [tool.mypy]
69
+ plugins = ["pydantic.mypy"]
70
+
71
+ [tool.ruff]
72
+ line-length = 120
73
+
74
+ [tool.ruff.lint]
75
+ select = [
76
+ "E", # pycodestyle errors
77
+ "F", # pyflakes
78
+ "I", # isort
79
+ ]
80
+ ignore = [
81
+ "E402", # Module level import not at top of file
82
+ "E501", # Line too long
83
+ "E711", # Comparison to `None` should be `cond is not None`
84
+ "E712", # Avoid equality comparisons to `True`; use `if ...:` checks
85
+ "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks
86
+ "E722", # Do not use bare `except`
87
+ "E731", # Do not assign a `lambda` expression, use a `def`
88
+ "F821", # Undefined name
89
+ "F841" # Local variable ... is assigned to but never used
90
+ ]
91
+
92
+ [tool.ruff.lint.isort]
93
+ section-order = ["future", "standard-library", "third-party", "first-party"]
94
+
95
+ [build-system]
96
+ requires = ["poetry-core"]
97
+ build-backend = "poetry.core.masonry.api"
98
+
99
+ [tool.poetry.extras]
100
+ aiohttp=["aiohttp", "httpx-aiohttp"]