worqhat 3.2.0__tar.gz → 3.4.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.
- worqhat-3.4.0/.release-please-manifest.json +3 -0
- worqhat-3.4.0/CHANGELOG.md +31 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/PKG-INFO +51 -17
- {worqhat-3.2.0 → worqhat-3.4.0}/README.md +50 -16
- worqhat-3.4.0/api.md +63 -0
- worqhat-3.4.0/bin/publish-pypi +6 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/pyproject.toml +1 -1
- worqhat-3.4.0/requirements-dev.lock +135 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_base_client.py +4 -1
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_client.py +24 -16
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_files.py +5 -5
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_version.py +1 -1
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/resources/__init__.py +14 -0
- worqhat-3.4.0/src/worqhat/resources/db.py +593 -0
- worqhat-3.4.0/src/worqhat/resources/flows.py +437 -0
- worqhat-3.4.0/src/worqhat/types/__init__.py +22 -0
- worqhat-3.4.0/src/worqhat/types/db_delete_records_params.py +15 -0
- worqhat-3.4.0/src/worqhat/types/db_delete_records_response.py +18 -0
- worqhat-3.4.0/src/worqhat/types/db_execute_query_params.py +12 -0
- worqhat-3.4.0/src/worqhat/types/db_execute_query_response.py +21 -0
- worqhat-3.4.0/src/worqhat/types/db_insert_record_params.py +15 -0
- worqhat-3.4.0/src/worqhat/types/db_insert_record_response.py +15 -0
- worqhat-3.4.0/src/worqhat/types/db_process_nl_query_params.py +15 -0
- worqhat-3.4.0/src/worqhat/types/db_process_nl_query_response.py +18 -0
- worqhat-3.4.0/src/worqhat/types/db_update_records_params.py +18 -0
- worqhat-3.4.0/src/worqhat/types/db_update_records_response.py +18 -0
- worqhat-3.2.0/src/worqhat/types/flow_retrieve_metrics_params.py → worqhat-3.4.0/src/worqhat/types/flow_get_metrics_params.py +2 -2
- worqhat-3.2.0/src/worqhat/types/flow_retrieve_metrics_response.py → worqhat-3.4.0/src/worqhat/types/flow_get_metrics_response.py +2 -2
- worqhat-3.4.0/src/worqhat/types/flow_trigger_with_file_params.py +17 -0
- worqhat-3.4.0/src/worqhat/types/flow_trigger_with_file_response.py +18 -0
- worqhat-3.4.0/src/worqhat/types/flow_trigger_with_payload_params.py +12 -0
- worqhat-3.4.0/src/worqhat/types/flow_trigger_with_payload_response.py +20 -0
- worqhat-3.2.0/src/worqhat/types/retrieve_server_info_response.py → worqhat-3.4.0/src/worqhat/types/get_server_info_response.py +2 -2
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/api_resources/test_client.py +19 -19
- worqhat-3.4.0/tests/api_resources/test_db.py +430 -0
- worqhat-3.4.0/tests/api_resources/test_flows.py +327 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_client.py +43 -21
- worqhat-3.2.0/.release-please-manifest.json +0 -3
- worqhat-3.2.0/CHANGELOG.md +0 -60
- worqhat-3.2.0/api.md +0 -35
- worqhat-3.2.0/bin/manual-publish-pypi +0 -62
- worqhat-3.2.0/bin/publish-pypi +0 -8
- worqhat-3.2.0/requirements-dev.lock +0 -135
- worqhat-3.2.0/src/worqhat/resources/flows.py +0 -223
- worqhat-3.2.0/src/worqhat/types/__init__.py +0 -8
- worqhat-3.2.0/tests/api_resources/test_flows.py +0 -103
- {worqhat-3.2.0 → worqhat-3.4.0}/.gitignore +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/CONTRIBUTING.md +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/LICENSE +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/SECURITY.md +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/bin/check-release-environment +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/examples/.keep +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/mypy.ini +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/noxfile.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/release-please-config.json +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/requirements.lock +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/__init__.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_compat.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_constants.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_exceptions.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_models.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_qs.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_resource.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_response.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_streaming.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_types.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/__init__.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_logs.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_proxy.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_reflection.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_resources_proxy.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_streams.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_sync.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_transform.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_typing.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/_utils/_utils.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/lib/.keep +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/py.typed +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/resources/health.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/src/worqhat/types/health_check_response.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/__init__.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/api_resources/__init__.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/api_resources/test_health.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/conftest.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/sample_file.txt +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_deepcopy.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_extract_files.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_files.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_models.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_qs.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_required_args.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_response.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_streaming.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_transform.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_utils/test_proxy.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/test_utils/test_typing.py +0 -0
- {worqhat-3.2.0 → worqhat-3.4.0}/tests/utils.py +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 3.4.0 (2025-07-31)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.0.1-alpha.0...v3.4.0](https://github.com/WorqHat/worqhat-python-sdk/compare/v0.0.1-alpha.0...v3.4.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update via SDK Studio ([ce75dcc](https://github.com/WorqHat/worqhat-python-sdk/commit/ce75dcc31b078bab025560c5b196a4eecf7f1227))
|
|
10
|
+
* **api:** update via SDK Studio ([ec19825](https://github.com/WorqHat/worqhat-python-sdk/commit/ec19825709fbe7994a811981d5eb77630a0594ce))
|
|
11
|
+
* **api:** update via SDK Studio ([85ab7a2](https://github.com/WorqHat/worqhat-python-sdk/commit/85ab7a2e5c871ed5921ef6044c0f9926b939948d))
|
|
12
|
+
* **api:** update via SDK Studio ([1dca18a](https://github.com/WorqHat/worqhat-python-sdk/commit/1dca18acf452a7cc35c6e541d69b8a31ac90d29a))
|
|
13
|
+
* **api:** update via SDK Studio ([fbb6ab5](https://github.com/WorqHat/worqhat-python-sdk/commit/fbb6ab5d66c30d8ee3bd9328eab85304efd42614))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Chores
|
|
17
|
+
|
|
18
|
+
* configure new SDK language ([c4d0258](https://github.com/WorqHat/worqhat-python-sdk/commit/c4d0258ea522088e0f6181228d1f04a64230b2d7))
|
|
19
|
+
* sync repo ([b2b1c38](https://github.com/WorqHat/worqhat-python-sdk/commit/b2b1c381aa08870a807c303164f6ff9689f8aea2))
|
|
20
|
+
* sync repo ([4766968](https://github.com/WorqHat/worqhat-python-sdk/commit/476696875aa8f142f588c4f016fa8110a0ec4e08))
|
|
21
|
+
* update SDK settings ([8d58885](https://github.com/WorqHat/worqhat-python-sdk/commit/8d5888563b3042cb684d9a4406a09edd2be22889))
|
|
22
|
+
* update SDK settings ([a1ff3c3](https://github.com/WorqHat/worqhat-python-sdk/commit/a1ff3c388307c293932c8ef069ae9ad3a03c393c))
|
|
23
|
+
* update SDK settings ([53e95ac](https://github.com/WorqHat/worqhat-python-sdk/commit/53e95acd14d9d4dd063c1c71a1ed0bcd9ab86e69))
|
|
24
|
+
* update SDK settings ([f5a73c5](https://github.com/WorqHat/worqhat-python-sdk/commit/f5a73c54db1e7d7d865701c79b13034a08ef5341))
|
|
25
|
+
* update SDK settings ([9ff0620](https://github.com/WorqHat/worqhat-python-sdk/commit/9ff062000f153819b5629a262395551a723b2382))
|
|
26
|
+
* update SDK settings ([d605766](https://github.com/WorqHat/worqhat-python-sdk/commit/d605766da0d10451b716cbf715c96e6b4ccf90b9))
|
|
27
|
+
* update SDK settings ([29497ca](https://github.com/WorqHat/worqhat-python-sdk/commit/29497ca3d7fc8232a9b0cc0fb70cb963c4624b33))
|
|
28
|
+
* update SDK settings ([e386fb8](https://github.com/WorqHat/worqhat-python-sdk/commit/e386fb86761c1ef06bd99b5a85b2fd6710d17737))
|
|
29
|
+
* update SDK settings ([0dbf509](https://github.com/WorqHat/worqhat-python-sdk/commit/0dbf5097e700966f2546ea967d0669eae280dbb9))
|
|
30
|
+
* update SDK settings ([64384f2](https://github.com/WorqHat/worqhat-python-sdk/commit/64384f2c7f05b7a54d89881791857068c10f1250))
|
|
31
|
+
* update SDK settings ([6c05440](https://github.com/WorqHat/worqhat-python-sdk/commit/6c05440a6f753841abdac7153f9bc0cb7688f7d9))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: worqhat
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.4.0
|
|
4
4
|
Summary: The official Python library for the worqhat API
|
|
5
5
|
Project-URL: Homepage, https://github.com/WorqHat/worqhat-python-sdk
|
|
6
6
|
Project-URL: Repository, https://github.com/WorqHat/worqhat-python-sdk
|
|
@@ -46,13 +46,13 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
46
46
|
|
|
47
47
|
## Documentation
|
|
48
48
|
|
|
49
|
-
The REST API documentation can be found on [
|
|
49
|
+
The REST API documentation can be found on [worqhat.com](https://worqhat.com/support). The full API of this library can be found in [api.md](https://github.com/WorqHat/worqhat-python-sdk/tree/main/api.md).
|
|
50
50
|
|
|
51
51
|
## Installation
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
54
|
# install from PyPI
|
|
55
|
-
pip install worqhat
|
|
55
|
+
pip install --pre worqhat
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Usage
|
|
@@ -67,8 +67,10 @@ client = Worqhat(
|
|
|
67
67
|
api_key=os.environ.get("WORQHAT_API_KEY"), # This is the default and can be omitted
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
-
response = client.
|
|
71
|
-
|
|
70
|
+
response = client.db.execute_query(
|
|
71
|
+
query="REPLACE_ME",
|
|
72
|
+
)
|
|
73
|
+
print(response.data)
|
|
72
74
|
```
|
|
73
75
|
|
|
74
76
|
While you can provide an `api_key` keyword argument,
|
|
@@ -91,8 +93,10 @@ client = AsyncWorqhat(
|
|
|
91
93
|
|
|
92
94
|
|
|
93
95
|
async def main() -> None:
|
|
94
|
-
response = await client.
|
|
95
|
-
|
|
96
|
+
response = await client.db.execute_query(
|
|
97
|
+
query="REPLACE_ME",
|
|
98
|
+
)
|
|
99
|
+
print(response.data)
|
|
96
100
|
|
|
97
101
|
|
|
98
102
|
asyncio.run(main())
|
|
@@ -108,7 +112,7 @@ You can enable this by installing `aiohttp`:
|
|
|
108
112
|
|
|
109
113
|
```sh
|
|
110
114
|
# install from PyPI
|
|
111
|
-
pip install worqhat[aiohttp]
|
|
115
|
+
pip install --pre worqhat[aiohttp]
|
|
112
116
|
```
|
|
113
117
|
|
|
114
118
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -124,8 +128,10 @@ async def main() -> None:
|
|
|
124
128
|
api_key="My API Key",
|
|
125
129
|
http_client=DefaultAioHttpClient(),
|
|
126
130
|
) as client:
|
|
127
|
-
response = await client.
|
|
128
|
-
|
|
131
|
+
response = await client.db.execute_query(
|
|
132
|
+
query="REPLACE_ME",
|
|
133
|
+
)
|
|
134
|
+
print(response.data)
|
|
129
135
|
|
|
130
136
|
|
|
131
137
|
asyncio.run(main())
|
|
@@ -140,6 +146,24 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
|
140
146
|
|
|
141
147
|
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
|
142
148
|
|
|
149
|
+
## File uploads
|
|
150
|
+
|
|
151
|
+
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
from pathlib import Path
|
|
155
|
+
from worqhat import Worqhat
|
|
156
|
+
|
|
157
|
+
client = Worqhat()
|
|
158
|
+
|
|
159
|
+
client.flows.trigger_with_file(
|
|
160
|
+
flow_id="f825ab82-371f-40cb-9bed-b325531ead4a",
|
|
161
|
+
file=Path("/path/to/file"),
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
|
|
166
|
+
|
|
143
167
|
## Handling errors
|
|
144
168
|
|
|
145
169
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `worqhat.APIConnectionError` is raised.
|
|
@@ -156,7 +180,9 @@ from worqhat import Worqhat
|
|
|
156
180
|
client = Worqhat()
|
|
157
181
|
|
|
158
182
|
try:
|
|
159
|
-
client.
|
|
183
|
+
client.db.execute_query(
|
|
184
|
+
query="REPLACE_ME",
|
|
185
|
+
)
|
|
160
186
|
except worqhat.APIConnectionError as e:
|
|
161
187
|
print("The server could not be reached")
|
|
162
188
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
|
@@ -199,7 +225,9 @@ client = Worqhat(
|
|
|
199
225
|
)
|
|
200
226
|
|
|
201
227
|
# Or, configure per-request:
|
|
202
|
-
client.with_options(max_retries=5).
|
|
228
|
+
client.with_options(max_retries=5).db.execute_query(
|
|
229
|
+
query="REPLACE_ME",
|
|
230
|
+
)
|
|
203
231
|
```
|
|
204
232
|
|
|
205
233
|
### Timeouts
|
|
@@ -222,7 +250,9 @@ client = Worqhat(
|
|
|
222
250
|
)
|
|
223
251
|
|
|
224
252
|
# Override per-request:
|
|
225
|
-
client.with_options(timeout=5.0).
|
|
253
|
+
client.with_options(timeout=5.0).db.execute_query(
|
|
254
|
+
query="REPLACE_ME",
|
|
255
|
+
)
|
|
226
256
|
```
|
|
227
257
|
|
|
228
258
|
On timeout, an `APITimeoutError` is thrown.
|
|
@@ -263,11 +293,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
263
293
|
from worqhat import Worqhat
|
|
264
294
|
|
|
265
295
|
client = Worqhat()
|
|
266
|
-
response = client.with_raw_response.
|
|
296
|
+
response = client.db.with_raw_response.execute_query(
|
|
297
|
+
query="REPLACE_ME",
|
|
298
|
+
)
|
|
267
299
|
print(response.headers.get('X-My-Header'))
|
|
268
300
|
|
|
269
|
-
|
|
270
|
-
print(
|
|
301
|
+
db = response.parse() # get the object that `db.execute_query()` would have returned
|
|
302
|
+
print(db.data)
|
|
271
303
|
```
|
|
272
304
|
|
|
273
305
|
These methods return an [`APIResponse`](https://github.com/WorqHat/worqhat-python-sdk/tree/main/src/worqhat/_response.py) object.
|
|
@@ -281,7 +313,9 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
281
313
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
282
314
|
|
|
283
315
|
```python
|
|
284
|
-
with client.with_streaming_response.
|
|
316
|
+
with client.db.with_streaming_response.execute_query(
|
|
317
|
+
query="REPLACE_ME",
|
|
318
|
+
) as response:
|
|
285
319
|
print(response.headers.get("X-My-Header"))
|
|
286
320
|
|
|
287
321
|
for line in response.iter_lines():
|
|
@@ -11,13 +11,13 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
11
11
|
|
|
12
12
|
## Documentation
|
|
13
13
|
|
|
14
|
-
The REST API documentation can be found on [
|
|
14
|
+
The REST API documentation can be found on [worqhat.com](https://worqhat.com/support). The full API of this library can be found in [api.md](api.md).
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
19
|
# install from PyPI
|
|
20
|
-
pip install worqhat
|
|
20
|
+
pip install --pre worqhat
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
@@ -32,8 +32,10 @@ client = Worqhat(
|
|
|
32
32
|
api_key=os.environ.get("WORQHAT_API_KEY"), # This is the default and can be omitted
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
-
response = client.
|
|
36
|
-
|
|
35
|
+
response = client.db.execute_query(
|
|
36
|
+
query="REPLACE_ME",
|
|
37
|
+
)
|
|
38
|
+
print(response.data)
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
While you can provide an `api_key` keyword argument,
|
|
@@ -56,8 +58,10 @@ client = AsyncWorqhat(
|
|
|
56
58
|
|
|
57
59
|
|
|
58
60
|
async def main() -> None:
|
|
59
|
-
response = await client.
|
|
60
|
-
|
|
61
|
+
response = await client.db.execute_query(
|
|
62
|
+
query="REPLACE_ME",
|
|
63
|
+
)
|
|
64
|
+
print(response.data)
|
|
61
65
|
|
|
62
66
|
|
|
63
67
|
asyncio.run(main())
|
|
@@ -73,7 +77,7 @@ You can enable this by installing `aiohttp`:
|
|
|
73
77
|
|
|
74
78
|
```sh
|
|
75
79
|
# install from PyPI
|
|
76
|
-
pip install worqhat[aiohttp]
|
|
80
|
+
pip install --pre worqhat[aiohttp]
|
|
77
81
|
```
|
|
78
82
|
|
|
79
83
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -89,8 +93,10 @@ async def main() -> None:
|
|
|
89
93
|
api_key="My API Key",
|
|
90
94
|
http_client=DefaultAioHttpClient(),
|
|
91
95
|
) as client:
|
|
92
|
-
response = await client.
|
|
93
|
-
|
|
96
|
+
response = await client.db.execute_query(
|
|
97
|
+
query="REPLACE_ME",
|
|
98
|
+
)
|
|
99
|
+
print(response.data)
|
|
94
100
|
|
|
95
101
|
|
|
96
102
|
asyncio.run(main())
|
|
@@ -105,6 +111,24 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
|
|
|
105
111
|
|
|
106
112
|
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
|
107
113
|
|
|
114
|
+
## File uploads
|
|
115
|
+
|
|
116
|
+
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from pathlib import Path
|
|
120
|
+
from worqhat import Worqhat
|
|
121
|
+
|
|
122
|
+
client = Worqhat()
|
|
123
|
+
|
|
124
|
+
client.flows.trigger_with_file(
|
|
125
|
+
flow_id="f825ab82-371f-40cb-9bed-b325531ead4a",
|
|
126
|
+
file=Path("/path/to/file"),
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
|
|
131
|
+
|
|
108
132
|
## Handling errors
|
|
109
133
|
|
|
110
134
|
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `worqhat.APIConnectionError` is raised.
|
|
@@ -121,7 +145,9 @@ from worqhat import Worqhat
|
|
|
121
145
|
client = Worqhat()
|
|
122
146
|
|
|
123
147
|
try:
|
|
124
|
-
client.
|
|
148
|
+
client.db.execute_query(
|
|
149
|
+
query="REPLACE_ME",
|
|
150
|
+
)
|
|
125
151
|
except worqhat.APIConnectionError as e:
|
|
126
152
|
print("The server could not be reached")
|
|
127
153
|
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
|
@@ -164,7 +190,9 @@ client = Worqhat(
|
|
|
164
190
|
)
|
|
165
191
|
|
|
166
192
|
# Or, configure per-request:
|
|
167
|
-
client.with_options(max_retries=5).
|
|
193
|
+
client.with_options(max_retries=5).db.execute_query(
|
|
194
|
+
query="REPLACE_ME",
|
|
195
|
+
)
|
|
168
196
|
```
|
|
169
197
|
|
|
170
198
|
### Timeouts
|
|
@@ -187,7 +215,9 @@ client = Worqhat(
|
|
|
187
215
|
)
|
|
188
216
|
|
|
189
217
|
# Override per-request:
|
|
190
|
-
client.with_options(timeout=5.0).
|
|
218
|
+
client.with_options(timeout=5.0).db.execute_query(
|
|
219
|
+
query="REPLACE_ME",
|
|
220
|
+
)
|
|
191
221
|
```
|
|
192
222
|
|
|
193
223
|
On timeout, an `APITimeoutError` is thrown.
|
|
@@ -228,11 +258,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
228
258
|
from worqhat import Worqhat
|
|
229
259
|
|
|
230
260
|
client = Worqhat()
|
|
231
|
-
response = client.with_raw_response.
|
|
261
|
+
response = client.db.with_raw_response.execute_query(
|
|
262
|
+
query="REPLACE_ME",
|
|
263
|
+
)
|
|
232
264
|
print(response.headers.get('X-My-Header'))
|
|
233
265
|
|
|
234
|
-
|
|
235
|
-
print(
|
|
266
|
+
db = response.parse() # get the object that `db.execute_query()` would have returned
|
|
267
|
+
print(db.data)
|
|
236
268
|
```
|
|
237
269
|
|
|
238
270
|
These methods return an [`APIResponse`](https://github.com/WorqHat/worqhat-python-sdk/tree/main/src/worqhat/_response.py) object.
|
|
@@ -246,7 +278,9 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
246
278
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
247
279
|
|
|
248
280
|
```python
|
|
249
|
-
with client.with_streaming_response.
|
|
281
|
+
with client.db.with_streaming_response.execute_query(
|
|
282
|
+
query="REPLACE_ME",
|
|
283
|
+
) as response:
|
|
250
284
|
print(response.headers.get("X-My-Header"))
|
|
251
285
|
|
|
252
286
|
for line in response.iter_lines():
|
worqhat-3.4.0/api.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Worqhat
|
|
2
|
+
|
|
3
|
+
Types:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from worqhat.types import GetServerInfoResponse
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Methods:
|
|
10
|
+
|
|
11
|
+
- <code title="get /">client.<a href="./src/worqhat/_client.py">get_server_info</a>() -> <a href="./src/worqhat/types/get_server_info_response.py">GetServerInfoResponse</a></code>
|
|
12
|
+
|
|
13
|
+
# DB
|
|
14
|
+
|
|
15
|
+
Types:
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from worqhat.types import (
|
|
19
|
+
DBDeleteRecordsResponse,
|
|
20
|
+
DBExecuteQueryResponse,
|
|
21
|
+
DBInsertRecordResponse,
|
|
22
|
+
DBProcessNlQueryResponse,
|
|
23
|
+
DBUpdateRecordsResponse,
|
|
24
|
+
)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Methods:
|
|
28
|
+
|
|
29
|
+
- <code title="delete /db/delete">client.db.<a href="./src/worqhat/resources/db.py">delete_records</a>(\*\*<a href="src/worqhat/types/db_delete_records_params.py">params</a>) -> <a href="./src/worqhat/types/db_delete_records_response.py">DBDeleteRecordsResponse</a></code>
|
|
30
|
+
- <code title="post /db/query">client.db.<a href="./src/worqhat/resources/db.py">execute_query</a>(\*\*<a href="src/worqhat/types/db_execute_query_params.py">params</a>) -> <a href="./src/worqhat/types/db_execute_query_response.py">DBExecuteQueryResponse</a></code>
|
|
31
|
+
- <code title="post /db/insert">client.db.<a href="./src/worqhat/resources/db.py">insert_record</a>(\*\*<a href="src/worqhat/types/db_insert_record_params.py">params</a>) -> <a href="./src/worqhat/types/db_insert_record_response.py">DBInsertRecordResponse</a></code>
|
|
32
|
+
- <code title="post /db/nl-query">client.db.<a href="./src/worqhat/resources/db.py">process_nl_query</a>(\*\*<a href="src/worqhat/types/db_process_nl_query_params.py">params</a>) -> <a href="./src/worqhat/types/db_process_nl_query_response.py">DBProcessNlQueryResponse</a></code>
|
|
33
|
+
- <code title="put /db/update">client.db.<a href="./src/worqhat/resources/db.py">update_records</a>(\*\*<a href="src/worqhat/types/db_update_records_params.py">params</a>) -> <a href="./src/worqhat/types/db_update_records_response.py">DBUpdateRecordsResponse</a></code>
|
|
34
|
+
|
|
35
|
+
# Health
|
|
36
|
+
|
|
37
|
+
Types:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from worqhat.types import HealthCheckResponse
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Methods:
|
|
44
|
+
|
|
45
|
+
- <code title="get /health">client.health.<a href="./src/worqhat/resources/health.py">check</a>() -> <a href="./src/worqhat/types/health_check_response.py">HealthCheckResponse</a></code>
|
|
46
|
+
|
|
47
|
+
# Flows
|
|
48
|
+
|
|
49
|
+
Types:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from worqhat.types import (
|
|
53
|
+
FlowGetMetricsResponse,
|
|
54
|
+
FlowTriggerWithFileResponse,
|
|
55
|
+
FlowTriggerWithPayloadResponse,
|
|
56
|
+
)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Methods:
|
|
60
|
+
|
|
61
|
+
- <code title="get /flows/metrics">client.flows.<a href="./src/worqhat/resources/flows.py">get_metrics</a>(\*\*<a href="src/worqhat/types/flow_get_metrics_params.py">params</a>) -> <a href="./src/worqhat/types/flow_get_metrics_response.py">FlowGetMetricsResponse</a></code>
|
|
62
|
+
- <code title="post /flows/file/{flowId}">client.flows.<a href="./src/worqhat/resources/flows.py">trigger_with_file</a>(flow_id, \*\*<a href="src/worqhat/types/flow_trigger_with_file_params.py">params</a>) -> <a href="./src/worqhat/types/flow_trigger_with_file_response.py">FlowTriggerWithFileResponse</a></code>
|
|
63
|
+
- <code title="post /flows/trigger/{flowId}">client.flows.<a href="./src/worqhat/resources/flows.py">trigger_with_payload</a>(flow_id, \*\*<a href="src/worqhat/types/flow_trigger_with_payload_params.py">params</a>) -> <a href="./src/worqhat/types/flow_trigger_with_payload_response.py">FlowTriggerWithPayloadResponse</a></code>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# generated by rye
|
|
2
|
+
# use `rye lock` or `rye sync` to update this lockfile
|
|
3
|
+
#
|
|
4
|
+
# last locked with the following flags:
|
|
5
|
+
# pre: false
|
|
6
|
+
# features: []
|
|
7
|
+
# all-features: true
|
|
8
|
+
# with-sources: false
|
|
9
|
+
# generate-hashes: false
|
|
10
|
+
# universal: false
|
|
11
|
+
|
|
12
|
+
-e file:.
|
|
13
|
+
aiohappyeyeballs==2.6.1
|
|
14
|
+
# via aiohttp
|
|
15
|
+
aiohttp==3.12.8
|
|
16
|
+
# via httpx-aiohttp
|
|
17
|
+
# via worqhat
|
|
18
|
+
aiosignal==1.3.2
|
|
19
|
+
# via aiohttp
|
|
20
|
+
annotated-types==0.6.0
|
|
21
|
+
# via pydantic
|
|
22
|
+
anyio==4.4.0
|
|
23
|
+
# via httpx
|
|
24
|
+
# via worqhat
|
|
25
|
+
argcomplete==3.1.2
|
|
26
|
+
# via nox
|
|
27
|
+
async-timeout==5.0.1
|
|
28
|
+
# via aiohttp
|
|
29
|
+
attrs==25.3.0
|
|
30
|
+
# via aiohttp
|
|
31
|
+
certifi==2023.7.22
|
|
32
|
+
# via httpcore
|
|
33
|
+
# via httpx
|
|
34
|
+
colorlog==6.7.0
|
|
35
|
+
# via nox
|
|
36
|
+
dirty-equals==0.6.0
|
|
37
|
+
distlib==0.3.7
|
|
38
|
+
# via virtualenv
|
|
39
|
+
distro==1.8.0
|
|
40
|
+
# via worqhat
|
|
41
|
+
exceptiongroup==1.2.2
|
|
42
|
+
# via anyio
|
|
43
|
+
# via pytest
|
|
44
|
+
execnet==2.1.1
|
|
45
|
+
# via pytest-xdist
|
|
46
|
+
filelock==3.12.4
|
|
47
|
+
# via virtualenv
|
|
48
|
+
frozenlist==1.6.2
|
|
49
|
+
# via aiohttp
|
|
50
|
+
# via aiosignal
|
|
51
|
+
h11==0.16.0
|
|
52
|
+
# via httpcore
|
|
53
|
+
httpcore==1.0.9
|
|
54
|
+
# via httpx
|
|
55
|
+
httpx==0.28.1
|
|
56
|
+
# via httpx-aiohttp
|
|
57
|
+
# via respx
|
|
58
|
+
# via worqhat
|
|
59
|
+
httpx-aiohttp==0.1.8
|
|
60
|
+
# via worqhat
|
|
61
|
+
idna==3.4
|
|
62
|
+
# via anyio
|
|
63
|
+
# via httpx
|
|
64
|
+
# via yarl
|
|
65
|
+
importlib-metadata==7.0.0
|
|
66
|
+
iniconfig==2.0.0
|
|
67
|
+
# via pytest
|
|
68
|
+
markdown-it-py==3.0.0
|
|
69
|
+
# via rich
|
|
70
|
+
mdurl==0.1.2
|
|
71
|
+
# via markdown-it-py
|
|
72
|
+
multidict==6.4.4
|
|
73
|
+
# via aiohttp
|
|
74
|
+
# via yarl
|
|
75
|
+
mypy==1.14.1
|
|
76
|
+
mypy-extensions==1.0.0
|
|
77
|
+
# via mypy
|
|
78
|
+
nest-asyncio==1.6.0
|
|
79
|
+
nodeenv==1.8.0
|
|
80
|
+
# via pyright
|
|
81
|
+
nox==2023.4.22
|
|
82
|
+
packaging==23.2
|
|
83
|
+
# via nox
|
|
84
|
+
# via pytest
|
|
85
|
+
platformdirs==3.11.0
|
|
86
|
+
# via virtualenv
|
|
87
|
+
pluggy==1.5.0
|
|
88
|
+
# via pytest
|
|
89
|
+
propcache==0.3.1
|
|
90
|
+
# via aiohttp
|
|
91
|
+
# via yarl
|
|
92
|
+
pydantic==2.10.3
|
|
93
|
+
# via worqhat
|
|
94
|
+
pydantic-core==2.27.1
|
|
95
|
+
# via pydantic
|
|
96
|
+
pygments==2.18.0
|
|
97
|
+
# via rich
|
|
98
|
+
pyright==1.1.399
|
|
99
|
+
pytest==8.3.3
|
|
100
|
+
# via pytest-asyncio
|
|
101
|
+
# via pytest-xdist
|
|
102
|
+
pytest-asyncio==0.24.0
|
|
103
|
+
pytest-xdist==3.7.0
|
|
104
|
+
python-dateutil==2.8.2
|
|
105
|
+
# via time-machine
|
|
106
|
+
pytz==2023.3.post1
|
|
107
|
+
# via dirty-equals
|
|
108
|
+
respx==0.22.0
|
|
109
|
+
rich==13.7.1
|
|
110
|
+
ruff==0.9.4
|
|
111
|
+
setuptools==68.2.2
|
|
112
|
+
# via nodeenv
|
|
113
|
+
six==1.16.0
|
|
114
|
+
# via python-dateutil
|
|
115
|
+
sniffio==1.3.0
|
|
116
|
+
# via anyio
|
|
117
|
+
# via worqhat
|
|
118
|
+
time-machine==2.9.0
|
|
119
|
+
tomli==2.0.2
|
|
120
|
+
# via mypy
|
|
121
|
+
# via pytest
|
|
122
|
+
typing-extensions==4.12.2
|
|
123
|
+
# via anyio
|
|
124
|
+
# via multidict
|
|
125
|
+
# via mypy
|
|
126
|
+
# via pydantic
|
|
127
|
+
# via pydantic-core
|
|
128
|
+
# via pyright
|
|
129
|
+
# via worqhat
|
|
130
|
+
virtualenv==20.24.5
|
|
131
|
+
# via nox
|
|
132
|
+
yarl==1.20.0
|
|
133
|
+
# via aiohttp
|
|
134
|
+
zipp==3.17.0
|
|
135
|
+
# via importlib-metadata
|
|
@@ -532,7 +532,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
532
532
|
is_body_allowed = options.method.lower() != "get"
|
|
533
533
|
|
|
534
534
|
if is_body_allowed:
|
|
535
|
-
|
|
535
|
+
if isinstance(json_data, bytes):
|
|
536
|
+
kwargs["content"] = json_data
|
|
537
|
+
else:
|
|
538
|
+
kwargs["json"] = json_data if is_given(json_data) else None
|
|
536
539
|
kwargs["files"] = files
|
|
537
540
|
else:
|
|
538
541
|
headers.pop("Content-Type", None)
|