nimble_python 0.2.0__tar.gz → 0.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.
- nimble_python-0.4.0/.release-please-manifest.json +3 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/CHANGELOG.md +37 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/LICENSE +1 -1
- {nimble_python-0.2.0 → nimble_python-0.4.0}/PKG-INFO +53 -68
- {nimble_python-0.2.0 → nimble_python-0.4.0}/README.md +50 -65
- {nimble_python-0.2.0 → nimble_python-0.4.0}/SECURITY.md +2 -2
- {nimble_python-0.2.0 → nimble_python-0.4.0}/api.md +19 -10
- {nimble_python-0.2.0 → nimble_python-0.4.0}/pyproject.toml +3 -3
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/__init__.py +5 -17
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_client.py +463 -227
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_constants.py +2 -2
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_exceptions.py +2 -2
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_resource.py +5 -5
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_response.py +2 -2
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_streaming.py +3 -3
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_logs.py +1 -1
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_version.py +1 -1
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/resources/__init__.py +14 -0
- nimble_python-0.4.0/src/nimble_python/resources/agents.py +280 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/resources/crawl.py +8 -193
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/__init__.py +7 -4
- nimble_python-0.4.0/src/nimble_python/types/agent_get_response.py +51 -0
- nimble_python-0.4.0/src/nimble_python/types/agent_list_params.py +18 -0
- nimble_python-0.4.0/src/nimble_python/types/agent_list_response.py +27 -0
- nimble_python-0.4.0/src/nimble_python/types/agent_response.py +321 -0
- nimble_python-0.4.0/src/nimble_python/types/client_agent_params.py +27 -0
- nimble_python-0.2.0/src/nimble_python/types/crawl_root_params.py → nimble_python-0.4.0/src/nimble_python/types/client_crawl_params.py +7 -45
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/client_extract_params.py +0 -34
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/crawl_list_params.py +1 -1
- nimble_python-0.4.0/src/nimble_python/types/crawl_list_response.py +127 -0
- nimble_python-0.4.0/src/nimble_python/types/crawl_response.py +103 -0
- nimble_python-0.4.0/src/nimble_python/types/crawl_status_response.py +8 -0
- nimble_python-0.4.0/src/nimble_python/types/extract_response.py +321 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/search_response.py +21 -1
- nimble_python-0.4.0/tests/api_resources/test_agents.py +184 -0
- nimble_python-0.4.0/tests/api_resources/test_client.py +1224 -0
- nimble_python-0.4.0/tests/api_resources/test_crawl.py +280 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/conftest.py +5 -5
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_client.py +124 -156
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_response.py +13 -13
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_streaming.py +15 -15
- {nimble_python-0.2.0 → nimble_python-0.4.0}/uv.lock +1 -1
- nimble_python-0.2.0/.release-please-manifest.json +0 -3
- nimble_python-0.2.0/src/nimble_python/types/client_extract_template_params.py +0 -14
- nimble_python-0.2.0/src/nimble_python/types/crawl_list_response.py +0 -1390
- nimble_python-0.2.0/src/nimble_python/types/crawl_root_response.py +0 -11
- nimble_python-0.2.0/src/nimble_python/types/crawl_status_response.py +0 -33
- nimble_python-0.2.0/src/nimble_python/types/extract_response.py +0 -11
- nimble_python-0.2.0/src/nimble_python/types/extract_template_response.py +0 -11
- nimble_python-0.2.0/tests/api_resources/test_client.py +0 -725
- nimble_python-0.2.0/tests/api_resources/test_crawl.py +0 -731
- {nimble_python-0.2.0 → nimble_python-0.4.0}/.gitignore +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/CONTRIBUTING.md +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/bin/check-release-environment +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/bin/publish-pypi +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/examples/.keep +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/release-please-config.json +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/requirements-dev.lock +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_base_client.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_compat.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_files.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_models.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_qs.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_types.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_compat.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_datetime_parse.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_json.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_proxy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_reflection.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_resources_proxy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_streams.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_sync.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_transform.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_typing.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/_utils/_utils.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/lib/.keep +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/py.typed +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/client_map_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/client_search_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/crawl_terminate_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimble_python/types/map_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/src/nimbleway/lib/.keep +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/api_resources/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/sample_file.txt +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_deepcopy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_extract_files.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_files.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_models.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_qs.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_required_args.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_transform.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_utils/test_json.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_utils/test_proxy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/test_utils/test_typing.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.4.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 (2026-02-09)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.3.0...v0.4.0](https://github.com/Nimbleway/nimble-python/compare/v0.3.0...v0.4.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** Add agents and rename agent ([a72d77b](https://github.com/Nimbleway/nimble-python/commit/a72d77b446b25b5f685066254ff0bdfb05918bad))
|
|
10
|
+
* **api:** api update ([6f67725](https://github.com/Nimbleway/nimble-python/commit/6f67725ba6f96018e072780ae22d38cfd1ba0ad8))
|
|
11
|
+
* **api:** Move crawl to client ([118165a](https://github.com/Nimbleway/nimble-python/commit/118165ab63206ae7e6435b8486c25f5bf71f55a5))
|
|
12
|
+
* **api:** To sdk.nimbleway.com ([3dc176d](https://github.com/Nimbleway/nimble-python/commit/3dc176de8a29d3df6bfb6385d941a7881a8f56cd))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Chores
|
|
16
|
+
|
|
17
|
+
* configure new SDK language ([1034102](https://github.com/Nimbleway/nimble-python/commit/103410232991048870d008a98e1a6a8baf8977d6))
|
|
18
|
+
|
|
19
|
+
## 0.3.0 (2026-02-03)
|
|
20
|
+
|
|
21
|
+
Full Changelog: [v0.2.0...v0.3.0](https://github.com/Nimbleway/nimble-python/compare/v0.2.0...v0.3.0)
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **api:** Increase default timeout ([bb00c82](https://github.com/Nimbleway/nimble-python/commit/bb00c82062da9d9e812383364adf8c5b31f3c787))
|
|
26
|
+
* **api:** manual updates ([fc70a1c](https://github.com/Nimbleway/nimble-python/commit/fc70a1cbc9dd6651de1ee8a564dfebb34f98af79))
|
|
27
|
+
* trigger new release ([e1af702](https://github.com/Nimbleway/nimble-python/commit/e1af702364372e7140b4ed647bf63181272eb7be))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Chores
|
|
31
|
+
|
|
32
|
+
* **api:** remove staging environment ([3788e48](https://github.com/Nimbleway/nimble-python/commit/3788e48dce4f59c8ecff201fc69078dc17a8d6e9))
|
|
33
|
+
* **api:** Rename to nimble ([0dcaeda](https://github.com/Nimbleway/nimble-python/commit/0dcaedab384eddc0202a3228f3e013fc97c8a398))
|
|
34
|
+
* remove custom code ([25cdd8b](https://github.com/Nimbleway/nimble-python/commit/25cdd8b57e91a4d1269ffc16de8ffb450560b425))
|
|
35
|
+
* trigger release ([15b0fdb](https://github.com/Nimbleway/nimble-python/commit/15b0fdba8e7cfefa23871a1f65e0e45d8d786cff))
|
|
36
|
+
* update SDK settings ([1eca32d](https://github.com/Nimbleway/nimble-python/commit/1eca32d03bf29acf16cd1c95a3bdf1fc8aa736e6))
|
|
37
|
+
* update SDK settings ([e5719fa](https://github.com/Nimbleway/nimble-python/commit/e5719fa5eb38f4d9559642824225e991fdfe78c4))
|
|
38
|
+
* update SDK settings ([b5717bf](https://github.com/Nimbleway/nimble-python/commit/b5717bf9aa3c3bae35331356817f4fcabc7914da))
|
|
39
|
+
|
|
3
40
|
## 0.2.0 (2026-02-03)
|
|
4
41
|
|
|
5
42
|
Full Changelog: [v0.1.0...v0.2.0](https://github.com/Nimbleway/nimble-python/compare/v0.1.0...v0.2.0)
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2026
|
|
189
|
+
Copyright 2026 Nimble
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nimble_python
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: The official Python library for the
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: The official Python library for the nimble API
|
|
5
5
|
Project-URL: Homepage, https://github.com/Nimbleway/nimble-python
|
|
6
6
|
Project-URL: Repository, https://github.com/Nimbleway/nimble-python
|
|
7
|
-
Author-email:
|
|
7
|
+
Author-email: Nimble <support@nimbleway.com>
|
|
8
8
|
License: Apache-2.0
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -33,12 +33,12 @@ Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
|
33
33
|
Requires-Dist: httpx-aiohttp>=0.1.9; extra == 'aiohttp'
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
36
|
-
#
|
|
36
|
+
# Nimble Python API library
|
|
37
37
|
|
|
38
38
|
<!-- prettier-ignore -->
|
|
39
39
|
[)](https://pypi.org/project/nimble_python/)
|
|
40
40
|
|
|
41
|
-
The
|
|
41
|
+
The Nimble Python library provides convenient access to the Nimble REST API from any Python 3.9+
|
|
42
42
|
application. The library includes type definitions for all request params and response fields,
|
|
43
43
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
44
44
|
|
|
@@ -46,10 +46,10 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
46
46
|
|
|
47
47
|
## MCP Server
|
|
48
48
|
|
|
49
|
-
Use the
|
|
49
|
+
Use the Nimble MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
|
|
50
50
|
|
|
51
|
-
[](https://cursor.com/en-US/install-mcp?name=nimble-mcp&config=
|
|
52
|
-
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22nimble-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fnimbleway.stlmcp.com%22%2C%22headers%22%3A%7B%22x-nimble-api-key%22%3A%22My%20API%20Key%22%7D%7D)
|
|
51
|
+
[](https://cursor.com/en-US/install-mcp?name=nimble-js-mcp&config=eyJuYW1lIjoibmltYmxlLWpzLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL25pbWJsZXdheS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW5pbWJsZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)
|
|
52
|
+
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22nimble-js-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fnimbleway.stlmcp.com%22%2C%22headers%22%3A%7B%22x-nimble-api-key%22%3A%22My%20API%20Key%22%7D%7D)
|
|
53
53
|
|
|
54
54
|
> Note: You may need to set environment variables in your MCP client.
|
|
55
55
|
|
|
@@ -60,32 +60,26 @@ The full API of this library can be found in [api.md](https://github.com/Nimblew
|
|
|
60
60
|
## Installation
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
|
-
# install from
|
|
64
|
-
pip install
|
|
63
|
+
# install from PyPI
|
|
64
|
+
pip install nimble_python
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
> [!NOTE]
|
|
68
|
-
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install nimble_python`
|
|
69
|
-
|
|
70
67
|
## Usage
|
|
71
68
|
|
|
72
69
|
The full API of this library can be found in [api.md](https://github.com/Nimbleway/nimble-python/tree/main/api.md).
|
|
73
70
|
|
|
74
71
|
```python
|
|
75
72
|
import os
|
|
76
|
-
from nimble_python import
|
|
73
|
+
from nimble_python import Nimble
|
|
77
74
|
|
|
78
|
-
client =
|
|
75
|
+
client = Nimble(
|
|
79
76
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
80
|
-
# defaults to "staging".
|
|
81
|
-
environment="production",
|
|
82
77
|
)
|
|
83
78
|
|
|
84
79
|
response = client.extract(
|
|
85
|
-
|
|
86
|
-
url="https://example.com",
|
|
80
|
+
url="https://example.com/page",
|
|
87
81
|
)
|
|
88
|
-
print(response.
|
|
82
|
+
print(response.task_id)
|
|
89
83
|
```
|
|
90
84
|
|
|
91
85
|
While you can provide an `api_key` keyword argument,
|
|
@@ -95,26 +89,23 @@ so that your API Key is not stored in source control.
|
|
|
95
89
|
|
|
96
90
|
## Async usage
|
|
97
91
|
|
|
98
|
-
Simply import `
|
|
92
|
+
Simply import `AsyncNimble` instead of `Nimble` and use `await` with each API call:
|
|
99
93
|
|
|
100
94
|
```python
|
|
101
95
|
import os
|
|
102
96
|
import asyncio
|
|
103
|
-
from nimble_python import
|
|
97
|
+
from nimble_python import AsyncNimble
|
|
104
98
|
|
|
105
|
-
client =
|
|
99
|
+
client = AsyncNimble(
|
|
106
100
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
107
|
-
# defaults to "staging".
|
|
108
|
-
environment="production",
|
|
109
101
|
)
|
|
110
102
|
|
|
111
103
|
|
|
112
104
|
async def main() -> None:
|
|
113
105
|
response = await client.extract(
|
|
114
|
-
|
|
115
|
-
url="https://example.com",
|
|
106
|
+
url="https://example.com/page",
|
|
116
107
|
)
|
|
117
|
-
print(response.
|
|
108
|
+
print(response.task_id)
|
|
118
109
|
|
|
119
110
|
|
|
120
111
|
asyncio.run(main())
|
|
@@ -129,8 +120,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
|
|
|
129
120
|
You can enable this by installing `aiohttp`:
|
|
130
121
|
|
|
131
122
|
```sh
|
|
132
|
-
# install from
|
|
133
|
-
pip install
|
|
123
|
+
# install from PyPI
|
|
124
|
+
pip install nimble_python[aiohttp]
|
|
134
125
|
```
|
|
135
126
|
|
|
136
127
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -139,19 +130,18 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
|
|
|
139
130
|
import os
|
|
140
131
|
import asyncio
|
|
141
132
|
from nimble_python import DefaultAioHttpClient
|
|
142
|
-
from nimble_python import
|
|
133
|
+
from nimble_python import AsyncNimble
|
|
143
134
|
|
|
144
135
|
|
|
145
136
|
async def main() -> None:
|
|
146
|
-
async with
|
|
137
|
+
async with AsyncNimble(
|
|
147
138
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
148
139
|
http_client=DefaultAioHttpClient(),
|
|
149
140
|
) as client:
|
|
150
141
|
response = await client.extract(
|
|
151
|
-
|
|
152
|
-
url="https://example.com",
|
|
142
|
+
url="https://example.com/page",
|
|
153
143
|
)
|
|
154
|
-
print(response.
|
|
144
|
+
print(response.task_id)
|
|
155
145
|
|
|
156
146
|
|
|
157
147
|
asyncio.run(main())
|
|
@@ -171,15 +161,15 @@ Typed requests and responses provide autocomplete and documentation within your
|
|
|
171
161
|
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
|
172
162
|
|
|
173
163
|
```python
|
|
174
|
-
from nimble_python import
|
|
164
|
+
from nimble_python import Nimble
|
|
175
165
|
|
|
176
|
-
client =
|
|
166
|
+
client = Nimble()
|
|
177
167
|
|
|
178
168
|
response = client.extract(
|
|
179
|
-
debug_options={},
|
|
180
169
|
url="https://example.com/page",
|
|
170
|
+
metadata={},
|
|
181
171
|
)
|
|
182
|
-
print(response.
|
|
172
|
+
print(response.metadata)
|
|
183
173
|
```
|
|
184
174
|
|
|
185
175
|
## Handling errors
|
|
@@ -193,14 +183,13 @@ All errors inherit from `nimble_python.APIError`.
|
|
|
193
183
|
|
|
194
184
|
```python
|
|
195
185
|
import nimble_python
|
|
196
|
-
from nimble_python import
|
|
186
|
+
from nimble_python import Nimble
|
|
197
187
|
|
|
198
|
-
client =
|
|
188
|
+
client = Nimble()
|
|
199
189
|
|
|
200
190
|
try:
|
|
201
191
|
client.extract(
|
|
202
|
-
|
|
203
|
-
url="https://example.com",
|
|
192
|
+
url="https://example.com/page",
|
|
204
193
|
)
|
|
205
194
|
except nimble_python.APIConnectionError as e:
|
|
206
195
|
print("The server could not be reached")
|
|
@@ -235,44 +224,42 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
|
|
|
235
224
|
You can use the `max_retries` option to configure or disable retry settings:
|
|
236
225
|
|
|
237
226
|
```python
|
|
238
|
-
from nimble_python import
|
|
227
|
+
from nimble_python import Nimble
|
|
239
228
|
|
|
240
229
|
# Configure the default for all requests:
|
|
241
|
-
client =
|
|
230
|
+
client = Nimble(
|
|
242
231
|
# default is 2
|
|
243
232
|
max_retries=0,
|
|
244
233
|
)
|
|
245
234
|
|
|
246
235
|
# Or, configure per-request:
|
|
247
236
|
client.with_options(max_retries=5).extract(
|
|
248
|
-
|
|
249
|
-
url="https://example.com",
|
|
237
|
+
url="https://example.com/page",
|
|
250
238
|
)
|
|
251
239
|
```
|
|
252
240
|
|
|
253
241
|
### Timeouts
|
|
254
242
|
|
|
255
|
-
By default requests time out after
|
|
243
|
+
By default requests time out after 3 minutes. You can configure this with a `timeout` option,
|
|
256
244
|
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
257
245
|
|
|
258
246
|
```python
|
|
259
|
-
from nimble_python import
|
|
247
|
+
from nimble_python import Nimble
|
|
260
248
|
|
|
261
249
|
# Configure the default for all requests:
|
|
262
|
-
client =
|
|
263
|
-
# 20 seconds (default is
|
|
250
|
+
client = Nimble(
|
|
251
|
+
# 20 seconds (default is 3 minutes)
|
|
264
252
|
timeout=20.0,
|
|
265
253
|
)
|
|
266
254
|
|
|
267
255
|
# More granular control:
|
|
268
|
-
client =
|
|
256
|
+
client = Nimble(
|
|
269
257
|
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
|
|
270
258
|
)
|
|
271
259
|
|
|
272
260
|
# Override per-request:
|
|
273
261
|
client.with_options(timeout=5.0).extract(
|
|
274
|
-
|
|
275
|
-
url="https://example.com",
|
|
262
|
+
url="https://example.com/page",
|
|
276
263
|
)
|
|
277
264
|
```
|
|
278
265
|
|
|
@@ -286,10 +273,10 @@ Note that requests that time out are [retried twice by default](https://github.c
|
|
|
286
273
|
|
|
287
274
|
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
|
|
288
275
|
|
|
289
|
-
You can enable logging by setting the environment variable `
|
|
276
|
+
You can enable logging by setting the environment variable `NIMBLE_LOG` to `info`.
|
|
290
277
|
|
|
291
278
|
```shell
|
|
292
|
-
$ export
|
|
279
|
+
$ export NIMBLE_LOG=info
|
|
293
280
|
```
|
|
294
281
|
|
|
295
282
|
Or to `debug` for more verbose logging.
|
|
@@ -311,17 +298,16 @@ if response.my_field is None:
|
|
|
311
298
|
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
|
312
299
|
|
|
313
300
|
```py
|
|
314
|
-
from nimble_python import
|
|
301
|
+
from nimble_python import Nimble
|
|
315
302
|
|
|
316
|
-
client =
|
|
303
|
+
client = Nimble()
|
|
317
304
|
response = client.with_raw_response.extract(
|
|
318
|
-
|
|
319
|
-
url="https://example.com",
|
|
305
|
+
url="https://example.com/page",
|
|
320
306
|
)
|
|
321
307
|
print(response.headers.get('X-My-Header'))
|
|
322
308
|
|
|
323
309
|
client = response.parse() # get the object that `extract()` would have returned
|
|
324
|
-
print(client.
|
|
310
|
+
print(client.task_id)
|
|
325
311
|
```
|
|
326
312
|
|
|
327
313
|
These methods return an [`APIResponse`](https://github.com/Nimbleway/nimble-python/tree/main/src/nimble_python/_response.py) object.
|
|
@@ -336,8 +322,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
336
322
|
|
|
337
323
|
```python
|
|
338
324
|
with client.with_streaming_response.extract(
|
|
339
|
-
|
|
340
|
-
url="https://example.com",
|
|
325
|
+
url="https://example.com/page",
|
|
341
326
|
) as response:
|
|
342
327
|
print(response.headers.get("X-My-Header"))
|
|
343
328
|
|
|
@@ -391,10 +376,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
|
|
|
391
376
|
|
|
392
377
|
```python
|
|
393
378
|
import httpx
|
|
394
|
-
from nimble_python import
|
|
379
|
+
from nimble_python import Nimble, DefaultHttpxClient
|
|
395
380
|
|
|
396
|
-
client =
|
|
397
|
-
# Or use the `
|
|
381
|
+
client = Nimble(
|
|
382
|
+
# Or use the `NIMBLE_BASE_URL` env var
|
|
398
383
|
base_url="http://my.test.server.example.com:8083",
|
|
399
384
|
http_client=DefaultHttpxClient(
|
|
400
385
|
proxy="http://my.test.proxy.example.com",
|
|
@@ -414,9 +399,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
|
414
399
|
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
|
|
415
400
|
|
|
416
401
|
```py
|
|
417
|
-
from nimble_python import
|
|
402
|
+
from nimble_python import Nimble
|
|
418
403
|
|
|
419
|
-
with
|
|
404
|
+
with Nimble() as client:
|
|
420
405
|
# make requests here
|
|
421
406
|
...
|
|
422
407
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Nimble Python API library
|
|
2
2
|
|
|
3
3
|
<!-- prettier-ignore -->
|
|
4
4
|
[)](https://pypi.org/project/nimble_python/)
|
|
5
5
|
|
|
6
|
-
The
|
|
6
|
+
The Nimble Python library provides convenient access to the Nimble REST API from any Python 3.9+
|
|
7
7
|
application. The library includes type definitions for all request params and response fields,
|
|
8
8
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
9
9
|
|
|
@@ -11,10 +11,10 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
11
11
|
|
|
12
12
|
## MCP Server
|
|
13
13
|
|
|
14
|
-
Use the
|
|
14
|
+
Use the Nimble MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
|
|
15
15
|
|
|
16
|
-
[](https://cursor.com/en-US/install-mcp?name=nimble-mcp&config=
|
|
17
|
-
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22nimble-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fnimbleway.stlmcp.com%22%2C%22headers%22%3A%7B%22x-nimble-api-key%22%3A%22My%20API%20Key%22%7D%7D)
|
|
16
|
+
[](https://cursor.com/en-US/install-mcp?name=nimble-js-mcp&config=eyJuYW1lIjoibmltYmxlLWpzLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL25pbWJsZXdheS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW5pbWJsZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)
|
|
17
|
+
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22nimble-js-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fnimbleway.stlmcp.com%22%2C%22headers%22%3A%7B%22x-nimble-api-key%22%3A%22My%20API%20Key%22%7D%7D)
|
|
18
18
|
|
|
19
19
|
> Note: You may need to set environment variables in your MCP client.
|
|
20
20
|
|
|
@@ -25,32 +25,26 @@ The full API of this library can be found in [api.md](api.md).
|
|
|
25
25
|
## Installation
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
# install from
|
|
29
|
-
pip install
|
|
28
|
+
# install from PyPI
|
|
29
|
+
pip install nimble_python
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
> [!NOTE]
|
|
33
|
-
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install nimble_python`
|
|
34
|
-
|
|
35
32
|
## Usage
|
|
36
33
|
|
|
37
34
|
The full API of this library can be found in [api.md](api.md).
|
|
38
35
|
|
|
39
36
|
```python
|
|
40
37
|
import os
|
|
41
|
-
from nimble_python import
|
|
38
|
+
from nimble_python import Nimble
|
|
42
39
|
|
|
43
|
-
client =
|
|
40
|
+
client = Nimble(
|
|
44
41
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
45
|
-
# defaults to "staging".
|
|
46
|
-
environment="production",
|
|
47
42
|
)
|
|
48
43
|
|
|
49
44
|
response = client.extract(
|
|
50
|
-
|
|
51
|
-
url="https://example.com",
|
|
45
|
+
url="https://example.com/page",
|
|
52
46
|
)
|
|
53
|
-
print(response.
|
|
47
|
+
print(response.task_id)
|
|
54
48
|
```
|
|
55
49
|
|
|
56
50
|
While you can provide an `api_key` keyword argument,
|
|
@@ -60,26 +54,23 @@ so that your API Key is not stored in source control.
|
|
|
60
54
|
|
|
61
55
|
## Async usage
|
|
62
56
|
|
|
63
|
-
Simply import `
|
|
57
|
+
Simply import `AsyncNimble` instead of `Nimble` and use `await` with each API call:
|
|
64
58
|
|
|
65
59
|
```python
|
|
66
60
|
import os
|
|
67
61
|
import asyncio
|
|
68
|
-
from nimble_python import
|
|
62
|
+
from nimble_python import AsyncNimble
|
|
69
63
|
|
|
70
|
-
client =
|
|
64
|
+
client = AsyncNimble(
|
|
71
65
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
72
|
-
# defaults to "staging".
|
|
73
|
-
environment="production",
|
|
74
66
|
)
|
|
75
67
|
|
|
76
68
|
|
|
77
69
|
async def main() -> None:
|
|
78
70
|
response = await client.extract(
|
|
79
|
-
|
|
80
|
-
url="https://example.com",
|
|
71
|
+
url="https://example.com/page",
|
|
81
72
|
)
|
|
82
|
-
print(response.
|
|
73
|
+
print(response.task_id)
|
|
83
74
|
|
|
84
75
|
|
|
85
76
|
asyncio.run(main())
|
|
@@ -94,8 +85,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
|
|
|
94
85
|
You can enable this by installing `aiohttp`:
|
|
95
86
|
|
|
96
87
|
```sh
|
|
97
|
-
# install from
|
|
98
|
-
pip install
|
|
88
|
+
# install from PyPI
|
|
89
|
+
pip install nimble_python[aiohttp]
|
|
99
90
|
```
|
|
100
91
|
|
|
101
92
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -104,19 +95,18 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
|
|
|
104
95
|
import os
|
|
105
96
|
import asyncio
|
|
106
97
|
from nimble_python import DefaultAioHttpClient
|
|
107
|
-
from nimble_python import
|
|
98
|
+
from nimble_python import AsyncNimble
|
|
108
99
|
|
|
109
100
|
|
|
110
101
|
async def main() -> None:
|
|
111
|
-
async with
|
|
102
|
+
async with AsyncNimble(
|
|
112
103
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
113
104
|
http_client=DefaultAioHttpClient(),
|
|
114
105
|
) as client:
|
|
115
106
|
response = await client.extract(
|
|
116
|
-
|
|
117
|
-
url="https://example.com",
|
|
107
|
+
url="https://example.com/page",
|
|
118
108
|
)
|
|
119
|
-
print(response.
|
|
109
|
+
print(response.task_id)
|
|
120
110
|
|
|
121
111
|
|
|
122
112
|
asyncio.run(main())
|
|
@@ -136,15 +126,15 @@ Typed requests and responses provide autocomplete and documentation within your
|
|
|
136
126
|
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
|
137
127
|
|
|
138
128
|
```python
|
|
139
|
-
from nimble_python import
|
|
129
|
+
from nimble_python import Nimble
|
|
140
130
|
|
|
141
|
-
client =
|
|
131
|
+
client = Nimble()
|
|
142
132
|
|
|
143
133
|
response = client.extract(
|
|
144
|
-
debug_options={},
|
|
145
134
|
url="https://example.com/page",
|
|
135
|
+
metadata={},
|
|
146
136
|
)
|
|
147
|
-
print(response.
|
|
137
|
+
print(response.metadata)
|
|
148
138
|
```
|
|
149
139
|
|
|
150
140
|
## Handling errors
|
|
@@ -158,14 +148,13 @@ All errors inherit from `nimble_python.APIError`.
|
|
|
158
148
|
|
|
159
149
|
```python
|
|
160
150
|
import nimble_python
|
|
161
|
-
from nimble_python import
|
|
151
|
+
from nimble_python import Nimble
|
|
162
152
|
|
|
163
|
-
client =
|
|
153
|
+
client = Nimble()
|
|
164
154
|
|
|
165
155
|
try:
|
|
166
156
|
client.extract(
|
|
167
|
-
|
|
168
|
-
url="https://example.com",
|
|
157
|
+
url="https://example.com/page",
|
|
169
158
|
)
|
|
170
159
|
except nimble_python.APIConnectionError as e:
|
|
171
160
|
print("The server could not be reached")
|
|
@@ -200,44 +189,42 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
|
|
|
200
189
|
You can use the `max_retries` option to configure or disable retry settings:
|
|
201
190
|
|
|
202
191
|
```python
|
|
203
|
-
from nimble_python import
|
|
192
|
+
from nimble_python import Nimble
|
|
204
193
|
|
|
205
194
|
# Configure the default for all requests:
|
|
206
|
-
client =
|
|
195
|
+
client = Nimble(
|
|
207
196
|
# default is 2
|
|
208
197
|
max_retries=0,
|
|
209
198
|
)
|
|
210
199
|
|
|
211
200
|
# Or, configure per-request:
|
|
212
201
|
client.with_options(max_retries=5).extract(
|
|
213
|
-
|
|
214
|
-
url="https://example.com",
|
|
202
|
+
url="https://example.com/page",
|
|
215
203
|
)
|
|
216
204
|
```
|
|
217
205
|
|
|
218
206
|
### Timeouts
|
|
219
207
|
|
|
220
|
-
By default requests time out after
|
|
208
|
+
By default requests time out after 3 minutes. You can configure this with a `timeout` option,
|
|
221
209
|
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
222
210
|
|
|
223
211
|
```python
|
|
224
|
-
from nimble_python import
|
|
212
|
+
from nimble_python import Nimble
|
|
225
213
|
|
|
226
214
|
# Configure the default for all requests:
|
|
227
|
-
client =
|
|
228
|
-
# 20 seconds (default is
|
|
215
|
+
client = Nimble(
|
|
216
|
+
# 20 seconds (default is 3 minutes)
|
|
229
217
|
timeout=20.0,
|
|
230
218
|
)
|
|
231
219
|
|
|
232
220
|
# More granular control:
|
|
233
|
-
client =
|
|
221
|
+
client = Nimble(
|
|
234
222
|
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
|
|
235
223
|
)
|
|
236
224
|
|
|
237
225
|
# Override per-request:
|
|
238
226
|
client.with_options(timeout=5.0).extract(
|
|
239
|
-
|
|
240
|
-
url="https://example.com",
|
|
227
|
+
url="https://example.com/page",
|
|
241
228
|
)
|
|
242
229
|
```
|
|
243
230
|
|
|
@@ -251,10 +238,10 @@ Note that requests that time out are [retried twice by default](#retries).
|
|
|
251
238
|
|
|
252
239
|
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
|
|
253
240
|
|
|
254
|
-
You can enable logging by setting the environment variable `
|
|
241
|
+
You can enable logging by setting the environment variable `NIMBLE_LOG` to `info`.
|
|
255
242
|
|
|
256
243
|
```shell
|
|
257
|
-
$ export
|
|
244
|
+
$ export NIMBLE_LOG=info
|
|
258
245
|
```
|
|
259
246
|
|
|
260
247
|
Or to `debug` for more verbose logging.
|
|
@@ -276,17 +263,16 @@ if response.my_field is None:
|
|
|
276
263
|
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
|
277
264
|
|
|
278
265
|
```py
|
|
279
|
-
from nimble_python import
|
|
266
|
+
from nimble_python import Nimble
|
|
280
267
|
|
|
281
|
-
client =
|
|
268
|
+
client = Nimble()
|
|
282
269
|
response = client.with_raw_response.extract(
|
|
283
|
-
|
|
284
|
-
url="https://example.com",
|
|
270
|
+
url="https://example.com/page",
|
|
285
271
|
)
|
|
286
272
|
print(response.headers.get('X-My-Header'))
|
|
287
273
|
|
|
288
274
|
client = response.parse() # get the object that `extract()` would have returned
|
|
289
|
-
print(client.
|
|
275
|
+
print(client.task_id)
|
|
290
276
|
```
|
|
291
277
|
|
|
292
278
|
These methods return an [`APIResponse`](https://github.com/Nimbleway/nimble-python/tree/main/src/nimble_python/_response.py) object.
|
|
@@ -301,8 +287,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
|
301
287
|
|
|
302
288
|
```python
|
|
303
289
|
with client.with_streaming_response.extract(
|
|
304
|
-
|
|
305
|
-
url="https://example.com",
|
|
290
|
+
url="https://example.com/page",
|
|
306
291
|
) as response:
|
|
307
292
|
print(response.headers.get("X-My-Header"))
|
|
308
293
|
|
|
@@ -356,10 +341,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
|
|
|
356
341
|
|
|
357
342
|
```python
|
|
358
343
|
import httpx
|
|
359
|
-
from nimble_python import
|
|
344
|
+
from nimble_python import Nimble, DefaultHttpxClient
|
|
360
345
|
|
|
361
|
-
client =
|
|
362
|
-
# Or use the `
|
|
346
|
+
client = Nimble(
|
|
347
|
+
# Or use the `NIMBLE_BASE_URL` env var
|
|
363
348
|
base_url="http://my.test.server.example.com:8083",
|
|
364
349
|
http_client=DefaultHttpxClient(
|
|
365
350
|
proxy="http://my.test.proxy.example.com",
|
|
@@ -379,9 +364,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
|
379
364
|
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
|
|
380
365
|
|
|
381
366
|
```py
|
|
382
|
-
from nimble_python import
|
|
367
|
+
from nimble_python import Nimble
|
|
383
368
|
|
|
384
|
-
with
|
|
369
|
+
with Nimble() as client:
|
|
385
370
|
# make requests here
|
|
386
371
|
...
|
|
387
372
|
|