nimble_python 0.2.0__tar.gz → 0.3.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.3.0/.release-please-manifest.json +3 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/CHANGELOG.md +21 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/LICENSE +1 -1
- {nimble_python-0.2.0 → nimble_python-0.3.0}/PKG-INFO +46 -53
- {nimble_python-0.2.0 → nimble_python-0.3.0}/README.md +43 -50
- {nimble_python-0.2.0 → nimble_python-0.3.0}/SECURITY.md +2 -2
- {nimble_python-0.2.0 → nimble_python-0.3.0}/api.md +1 -1
- {nimble_python-0.2.0 → nimble_python-0.3.0}/pyproject.toml +3 -3
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/__init__.py +5 -17
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_client.py +40 -107
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_constants.py +2 -2
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_exceptions.py +2 -2
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_resource.py +5 -5
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_response.py +2 -2
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_streaming.py +3 -3
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_logs.py +1 -1
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_version.py +1 -1
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/api_resources/test_client.py +31 -31
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/api_resources/test_crawl.py +33 -33
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/conftest.py +5 -5
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_client.py +114 -142
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_response.py +13 -13
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_streaming.py +15 -15
- {nimble_python-0.2.0 → nimble_python-0.3.0}/uv.lock +1 -1
- nimble_python-0.2.0/.release-please-manifest.json +0 -3
- {nimble_python-0.2.0 → nimble_python-0.3.0}/.gitignore +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/CONTRIBUTING.md +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/bin/check-release-environment +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/bin/publish-pypi +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/examples/.keep +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/release-please-config.json +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/requirements-dev.lock +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_base_client.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_compat.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_files.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_models.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_qs.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_types.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_compat.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_datetime_parse.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_json.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_proxy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_reflection.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_resources_proxy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_streams.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_sync.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_transform.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_typing.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/_utils/_utils.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/lib/.keep +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/py.typed +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/resources/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/resources/crawl.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/client_extract_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/client_extract_template_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/client_map_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/client_search_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/crawl_list_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/crawl_list_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/crawl_root_params.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/crawl_root_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/crawl_status_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/crawl_terminate_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/extract_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/extract_template_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/map_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimble_python/types/search_response.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/src/nimbleway/lib/.keep +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/api_resources/__init__.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/sample_file.txt +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_deepcopy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_extract_files.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_files.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_models.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_qs.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_required_args.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_transform.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_utils/test_json.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_utils/test_proxy.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/test_utils/test_typing.py +0 -0
- {nimble_python-0.2.0 → nimble_python-0.3.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 (2026-02-03)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.2.0...v0.3.0](https://github.com/Nimbleway/nimble-python/compare/v0.2.0...v0.3.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** Increase default timeout ([bb00c82](https://github.com/Nimbleway/nimble-python/commit/bb00c82062da9d9e812383364adf8c5b31f3c787))
|
|
10
|
+
* **api:** manual updates ([fc70a1c](https://github.com/Nimbleway/nimble-python/commit/fc70a1cbc9dd6651de1ee8a564dfebb34f98af79))
|
|
11
|
+
* trigger new release ([e1af702](https://github.com/Nimbleway/nimble-python/commit/e1af702364372e7140b4ed647bf63181272eb7be))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Chores
|
|
15
|
+
|
|
16
|
+
* **api:** remove staging environment ([3788e48](https://github.com/Nimbleway/nimble-python/commit/3788e48dce4f59c8ecff201fc69078dc17a8d6e9))
|
|
17
|
+
* **api:** Rename to nimble ([0dcaeda](https://github.com/Nimbleway/nimble-python/commit/0dcaedab384eddc0202a3228f3e013fc97c8a398))
|
|
18
|
+
* remove custom code ([25cdd8b](https://github.com/Nimbleway/nimble-python/commit/25cdd8b57e91a4d1269ffc16de8ffb450560b425))
|
|
19
|
+
* trigger release ([15b0fdb](https://github.com/Nimbleway/nimble-python/commit/15b0fdba8e7cfefa23871a1f65e0e45d8d786cff))
|
|
20
|
+
* update SDK settings ([1eca32d](https://github.com/Nimbleway/nimble-python/commit/1eca32d03bf29acf16cd1c95a3bdf1fc8aa736e6))
|
|
21
|
+
* update SDK settings ([e5719fa](https://github.com/Nimbleway/nimble-python/commit/e5719fa5eb38f4d9559642824225e991fdfe78c4))
|
|
22
|
+
* update SDK settings ([b5717bf](https://github.com/Nimbleway/nimble-python/commit/b5717bf9aa3c3bae35331356817f4fcabc7914da))
|
|
23
|
+
|
|
3
24
|
## 0.2.0 (2026-02-03)
|
|
4
25
|
|
|
5
26
|
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.3.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,7 +46,7 @@ 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
51
|
[](https://cursor.com/en-US/install-mcp?name=nimble-mcp&config=eyJuYW1lIjoibmltYmxlLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL25pbWJsZXdheS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW5pbWJsZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)
|
|
52
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)
|
|
@@ -60,30 +60,25 @@ 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
|
-
response = client.
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
response = client.extract_template(
|
|
80
|
+
params={"prompt": "Who is the best NBA of all times?"},
|
|
81
|
+
template="chatgpt",
|
|
87
82
|
)
|
|
88
83
|
print(response.id)
|
|
89
84
|
```
|
|
@@ -95,24 +90,22 @@ so that your API Key is not stored in source control.
|
|
|
95
90
|
|
|
96
91
|
## Async usage
|
|
97
92
|
|
|
98
|
-
Simply import `
|
|
93
|
+
Simply import `AsyncNimble` instead of `Nimble` and use `await` with each API call:
|
|
99
94
|
|
|
100
95
|
```python
|
|
101
96
|
import os
|
|
102
97
|
import asyncio
|
|
103
|
-
from nimble_python import
|
|
98
|
+
from nimble_python import AsyncNimble
|
|
104
99
|
|
|
105
|
-
client =
|
|
100
|
+
client = AsyncNimble(
|
|
106
101
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
107
|
-
# defaults to "staging".
|
|
108
|
-
environment="production",
|
|
109
102
|
)
|
|
110
103
|
|
|
111
104
|
|
|
112
105
|
async def main() -> None:
|
|
113
|
-
response = await client.
|
|
114
|
-
|
|
115
|
-
|
|
106
|
+
response = await client.extract_template(
|
|
107
|
+
params={"prompt": "Who is the best NBA of all times?"},
|
|
108
|
+
template="chatgpt",
|
|
116
109
|
)
|
|
117
110
|
print(response.id)
|
|
118
111
|
|
|
@@ -129,8 +122,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
|
|
|
129
122
|
You can enable this by installing `aiohttp`:
|
|
130
123
|
|
|
131
124
|
```sh
|
|
132
|
-
# install from
|
|
133
|
-
pip install
|
|
125
|
+
# install from PyPI
|
|
126
|
+
pip install nimble_python[aiohttp]
|
|
134
127
|
```
|
|
135
128
|
|
|
136
129
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -139,17 +132,17 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
|
|
|
139
132
|
import os
|
|
140
133
|
import asyncio
|
|
141
134
|
from nimble_python import DefaultAioHttpClient
|
|
142
|
-
from nimble_python import
|
|
135
|
+
from nimble_python import AsyncNimble
|
|
143
136
|
|
|
144
137
|
|
|
145
138
|
async def main() -> None:
|
|
146
|
-
async with
|
|
139
|
+
async with AsyncNimble(
|
|
147
140
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
148
141
|
http_client=DefaultAioHttpClient(),
|
|
149
142
|
) as client:
|
|
150
|
-
response = await client.
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
response = await client.extract_template(
|
|
144
|
+
params={"prompt": "Who is the best NBA of all times?"},
|
|
145
|
+
template="chatgpt",
|
|
153
146
|
)
|
|
154
147
|
print(response.id)
|
|
155
148
|
|
|
@@ -171,9 +164,9 @@ Typed requests and responses provide autocomplete and documentation within your
|
|
|
171
164
|
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
|
172
165
|
|
|
173
166
|
```python
|
|
174
|
-
from nimble_python import
|
|
167
|
+
from nimble_python import Nimble
|
|
175
168
|
|
|
176
|
-
client =
|
|
169
|
+
client = Nimble()
|
|
177
170
|
|
|
178
171
|
response = client.extract(
|
|
179
172
|
debug_options={},
|
|
@@ -193,9 +186,9 @@ All errors inherit from `nimble_python.APIError`.
|
|
|
193
186
|
|
|
194
187
|
```python
|
|
195
188
|
import nimble_python
|
|
196
|
-
from nimble_python import
|
|
189
|
+
from nimble_python import Nimble
|
|
197
190
|
|
|
198
|
-
client =
|
|
191
|
+
client = Nimble()
|
|
199
192
|
|
|
200
193
|
try:
|
|
201
194
|
client.extract(
|
|
@@ -235,10 +228,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
|
|
|
235
228
|
You can use the `max_retries` option to configure or disable retry settings:
|
|
236
229
|
|
|
237
230
|
```python
|
|
238
|
-
from nimble_python import
|
|
231
|
+
from nimble_python import Nimble
|
|
239
232
|
|
|
240
233
|
# Configure the default for all requests:
|
|
241
|
-
client =
|
|
234
|
+
client = Nimble(
|
|
242
235
|
# default is 2
|
|
243
236
|
max_retries=0,
|
|
244
237
|
)
|
|
@@ -252,20 +245,20 @@ client.with_options(max_retries=5).extract(
|
|
|
252
245
|
|
|
253
246
|
### Timeouts
|
|
254
247
|
|
|
255
|
-
By default requests time out after
|
|
248
|
+
By default requests time out after 3 minutes. You can configure this with a `timeout` option,
|
|
256
249
|
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
257
250
|
|
|
258
251
|
```python
|
|
259
|
-
from nimble_python import
|
|
252
|
+
from nimble_python import Nimble
|
|
260
253
|
|
|
261
254
|
# Configure the default for all requests:
|
|
262
|
-
client =
|
|
263
|
-
# 20 seconds (default is
|
|
255
|
+
client = Nimble(
|
|
256
|
+
# 20 seconds (default is 3 minutes)
|
|
264
257
|
timeout=20.0,
|
|
265
258
|
)
|
|
266
259
|
|
|
267
260
|
# More granular control:
|
|
268
|
-
client =
|
|
261
|
+
client = Nimble(
|
|
269
262
|
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
|
|
270
263
|
)
|
|
271
264
|
|
|
@@ -286,10 +279,10 @@ Note that requests that time out are [retried twice by default](https://github.c
|
|
|
286
279
|
|
|
287
280
|
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
|
|
288
281
|
|
|
289
|
-
You can enable logging by setting the environment variable `
|
|
282
|
+
You can enable logging by setting the environment variable `NIMBLE_LOG` to `info`.
|
|
290
283
|
|
|
291
284
|
```shell
|
|
292
|
-
$ export
|
|
285
|
+
$ export NIMBLE_LOG=info
|
|
293
286
|
```
|
|
294
287
|
|
|
295
288
|
Or to `debug` for more verbose logging.
|
|
@@ -311,9 +304,9 @@ if response.my_field is None:
|
|
|
311
304
|
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
|
312
305
|
|
|
313
306
|
```py
|
|
314
|
-
from nimble_python import
|
|
307
|
+
from nimble_python import Nimble
|
|
315
308
|
|
|
316
|
-
client =
|
|
309
|
+
client = Nimble()
|
|
317
310
|
response = client.with_raw_response.extract(
|
|
318
311
|
debug_options={},
|
|
319
312
|
url="https://example.com",
|
|
@@ -391,10 +384,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
|
|
|
391
384
|
|
|
392
385
|
```python
|
|
393
386
|
import httpx
|
|
394
|
-
from nimble_python import
|
|
387
|
+
from nimble_python import Nimble, DefaultHttpxClient
|
|
395
388
|
|
|
396
|
-
client =
|
|
397
|
-
# Or use the `
|
|
389
|
+
client = Nimble(
|
|
390
|
+
# Or use the `NIMBLE_BASE_URL` env var
|
|
398
391
|
base_url="http://my.test.server.example.com:8083",
|
|
399
392
|
http_client=DefaultHttpxClient(
|
|
400
393
|
proxy="http://my.test.proxy.example.com",
|
|
@@ -414,9 +407,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
|
414
407
|
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
408
|
|
|
416
409
|
```py
|
|
417
|
-
from nimble_python import
|
|
410
|
+
from nimble_python import Nimble
|
|
418
411
|
|
|
419
|
-
with
|
|
412
|
+
with Nimble() as client:
|
|
420
413
|
# make requests here
|
|
421
414
|
...
|
|
422
415
|
|
|
@@ -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,7 +11,7 @@ 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
16
|
[](https://cursor.com/en-US/install-mcp?name=nimble-mcp&config=eyJuYW1lIjoibmltYmxlLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL25pbWJsZXdheS5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LW5pbWJsZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)
|
|
17
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)
|
|
@@ -25,30 +25,25 @@ 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
|
-
response = client.
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
response = client.extract_template(
|
|
45
|
+
params={"prompt": "Who is the best NBA of all times?"},
|
|
46
|
+
template="chatgpt",
|
|
52
47
|
)
|
|
53
48
|
print(response.id)
|
|
54
49
|
```
|
|
@@ -60,24 +55,22 @@ so that your API Key is not stored in source control.
|
|
|
60
55
|
|
|
61
56
|
## Async usage
|
|
62
57
|
|
|
63
|
-
Simply import `
|
|
58
|
+
Simply import `AsyncNimble` instead of `Nimble` and use `await` with each API call:
|
|
64
59
|
|
|
65
60
|
```python
|
|
66
61
|
import os
|
|
67
62
|
import asyncio
|
|
68
|
-
from nimble_python import
|
|
63
|
+
from nimble_python import AsyncNimble
|
|
69
64
|
|
|
70
|
-
client =
|
|
65
|
+
client = AsyncNimble(
|
|
71
66
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
72
|
-
# defaults to "staging".
|
|
73
|
-
environment="production",
|
|
74
67
|
)
|
|
75
68
|
|
|
76
69
|
|
|
77
70
|
async def main() -> None:
|
|
78
|
-
response = await client.
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
response = await client.extract_template(
|
|
72
|
+
params={"prompt": "Who is the best NBA of all times?"},
|
|
73
|
+
template="chatgpt",
|
|
81
74
|
)
|
|
82
75
|
print(response.id)
|
|
83
76
|
|
|
@@ -94,8 +87,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
|
|
|
94
87
|
You can enable this by installing `aiohttp`:
|
|
95
88
|
|
|
96
89
|
```sh
|
|
97
|
-
# install from
|
|
98
|
-
pip install
|
|
90
|
+
# install from PyPI
|
|
91
|
+
pip install nimble_python[aiohttp]
|
|
99
92
|
```
|
|
100
93
|
|
|
101
94
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
@@ -104,17 +97,17 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
|
|
|
104
97
|
import os
|
|
105
98
|
import asyncio
|
|
106
99
|
from nimble_python import DefaultAioHttpClient
|
|
107
|
-
from nimble_python import
|
|
100
|
+
from nimble_python import AsyncNimble
|
|
108
101
|
|
|
109
102
|
|
|
110
103
|
async def main() -> None:
|
|
111
|
-
async with
|
|
104
|
+
async with AsyncNimble(
|
|
112
105
|
api_key=os.environ.get("NIMBLE_API_KEY"), # This is the default and can be omitted
|
|
113
106
|
http_client=DefaultAioHttpClient(),
|
|
114
107
|
) as client:
|
|
115
|
-
response = await client.
|
|
116
|
-
|
|
117
|
-
|
|
108
|
+
response = await client.extract_template(
|
|
109
|
+
params={"prompt": "Who is the best NBA of all times?"},
|
|
110
|
+
template="chatgpt",
|
|
118
111
|
)
|
|
119
112
|
print(response.id)
|
|
120
113
|
|
|
@@ -136,9 +129,9 @@ Typed requests and responses provide autocomplete and documentation within your
|
|
|
136
129
|
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
|
137
130
|
|
|
138
131
|
```python
|
|
139
|
-
from nimble_python import
|
|
132
|
+
from nimble_python import Nimble
|
|
140
133
|
|
|
141
|
-
client =
|
|
134
|
+
client = Nimble()
|
|
142
135
|
|
|
143
136
|
response = client.extract(
|
|
144
137
|
debug_options={},
|
|
@@ -158,9 +151,9 @@ All errors inherit from `nimble_python.APIError`.
|
|
|
158
151
|
|
|
159
152
|
```python
|
|
160
153
|
import nimble_python
|
|
161
|
-
from nimble_python import
|
|
154
|
+
from nimble_python import Nimble
|
|
162
155
|
|
|
163
|
-
client =
|
|
156
|
+
client = Nimble()
|
|
164
157
|
|
|
165
158
|
try:
|
|
166
159
|
client.extract(
|
|
@@ -200,10 +193,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
|
|
|
200
193
|
You can use the `max_retries` option to configure or disable retry settings:
|
|
201
194
|
|
|
202
195
|
```python
|
|
203
|
-
from nimble_python import
|
|
196
|
+
from nimble_python import Nimble
|
|
204
197
|
|
|
205
198
|
# Configure the default for all requests:
|
|
206
|
-
client =
|
|
199
|
+
client = Nimble(
|
|
207
200
|
# default is 2
|
|
208
201
|
max_retries=0,
|
|
209
202
|
)
|
|
@@ -217,20 +210,20 @@ client.with_options(max_retries=5).extract(
|
|
|
217
210
|
|
|
218
211
|
### Timeouts
|
|
219
212
|
|
|
220
|
-
By default requests time out after
|
|
213
|
+
By default requests time out after 3 minutes. You can configure this with a `timeout` option,
|
|
221
214
|
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
222
215
|
|
|
223
216
|
```python
|
|
224
|
-
from nimble_python import
|
|
217
|
+
from nimble_python import Nimble
|
|
225
218
|
|
|
226
219
|
# Configure the default for all requests:
|
|
227
|
-
client =
|
|
228
|
-
# 20 seconds (default is
|
|
220
|
+
client = Nimble(
|
|
221
|
+
# 20 seconds (default is 3 minutes)
|
|
229
222
|
timeout=20.0,
|
|
230
223
|
)
|
|
231
224
|
|
|
232
225
|
# More granular control:
|
|
233
|
-
client =
|
|
226
|
+
client = Nimble(
|
|
234
227
|
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
|
|
235
228
|
)
|
|
236
229
|
|
|
@@ -251,10 +244,10 @@ Note that requests that time out are [retried twice by default](#retries).
|
|
|
251
244
|
|
|
252
245
|
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
|
|
253
246
|
|
|
254
|
-
You can enable logging by setting the environment variable `
|
|
247
|
+
You can enable logging by setting the environment variable `NIMBLE_LOG` to `info`.
|
|
255
248
|
|
|
256
249
|
```shell
|
|
257
|
-
$ export
|
|
250
|
+
$ export NIMBLE_LOG=info
|
|
258
251
|
```
|
|
259
252
|
|
|
260
253
|
Or to `debug` for more verbose logging.
|
|
@@ -276,9 +269,9 @@ if response.my_field is None:
|
|
|
276
269
|
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
|
277
270
|
|
|
278
271
|
```py
|
|
279
|
-
from nimble_python import
|
|
272
|
+
from nimble_python import Nimble
|
|
280
273
|
|
|
281
|
-
client =
|
|
274
|
+
client = Nimble()
|
|
282
275
|
response = client.with_raw_response.extract(
|
|
283
276
|
debug_options={},
|
|
284
277
|
url="https://example.com",
|
|
@@ -356,10 +349,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
|
|
|
356
349
|
|
|
357
350
|
```python
|
|
358
351
|
import httpx
|
|
359
|
-
from nimble_python import
|
|
352
|
+
from nimble_python import Nimble, DefaultHttpxClient
|
|
360
353
|
|
|
361
|
-
client =
|
|
362
|
-
# Or use the `
|
|
354
|
+
client = Nimble(
|
|
355
|
+
# Or use the `NIMBLE_BASE_URL` env var
|
|
363
356
|
base_url="http://my.test.server.example.com:8083",
|
|
364
357
|
http_client=DefaultHttpxClient(
|
|
365
358
|
proxy="http://my.test.proxy.example.com",
|
|
@@ -379,9 +372,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
|
|
|
379
372
|
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
373
|
|
|
381
374
|
```py
|
|
382
|
-
from nimble_python import
|
|
375
|
+
from nimble_python import Nimble
|
|
383
376
|
|
|
384
|
-
with
|
|
377
|
+
with Nimble() as client:
|
|
385
378
|
# make requests here
|
|
386
379
|
...
|
|
387
380
|
|
|
@@ -16,9 +16,9 @@ before making any information public.
|
|
|
16
16
|
## Reporting Non-SDK Related Security Issues
|
|
17
17
|
|
|
18
18
|
If you encounter security issues that are not directly related to SDKs but pertain to the services
|
|
19
|
-
or products provided by
|
|
19
|
+
or products provided by Nimble, please follow the respective company's security reporting guidelines.
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### Nimble Terms and Policies
|
|
22
22
|
|
|
23
23
|
Please contact support@nimbleway.com for any questions or concerns regarding the security of our services.
|
|
24
24
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nimble_python"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "The official Python library for the
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "The official Python library for the nimble API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
7
7
|
authors = [
|
|
8
|
-
{ name = "
|
|
8
|
+
{ name = "Nimble", email = "support@nimbleway.com" },
|
|
9
9
|
]
|
|
10
10
|
|
|
11
11
|
dependencies = [
|
|
@@ -5,28 +5,17 @@ import typing as _t
|
|
|
5
5
|
from . import types
|
|
6
6
|
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
|
|
7
7
|
from ._utils import file_from_path
|
|
8
|
-
from ._client import
|
|
9
|
-
ENVIRONMENTS,
|
|
10
|
-
Client,
|
|
11
|
-
Stream,
|
|
12
|
-
Timeout,
|
|
13
|
-
Nimbleway,
|
|
14
|
-
Transport,
|
|
15
|
-
AsyncClient,
|
|
16
|
-
AsyncStream,
|
|
17
|
-
AsyncNimbleway,
|
|
18
|
-
RequestOptions,
|
|
19
|
-
)
|
|
8
|
+
from ._client import Client, Nimble, Stream, Timeout, Transport, AsyncClient, AsyncNimble, AsyncStream, RequestOptions
|
|
20
9
|
from ._models import BaseModel
|
|
21
10
|
from ._version import __title__, __version__
|
|
22
11
|
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
|
|
23
12
|
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
|
|
24
13
|
from ._exceptions import (
|
|
25
14
|
APIError,
|
|
15
|
+
NimbleError,
|
|
26
16
|
ConflictError,
|
|
27
17
|
NotFoundError,
|
|
28
18
|
APIStatusError,
|
|
29
|
-
NimblewayError,
|
|
30
19
|
RateLimitError,
|
|
31
20
|
APITimeoutError,
|
|
32
21
|
BadRequestError,
|
|
@@ -52,7 +41,7 @@ __all__ = [
|
|
|
52
41
|
"not_given",
|
|
53
42
|
"Omit",
|
|
54
43
|
"omit",
|
|
55
|
-
"
|
|
44
|
+
"NimbleError",
|
|
56
45
|
"APIError",
|
|
57
46
|
"APIStatusError",
|
|
58
47
|
"APITimeoutError",
|
|
@@ -72,9 +61,8 @@ __all__ = [
|
|
|
72
61
|
"AsyncClient",
|
|
73
62
|
"Stream",
|
|
74
63
|
"AsyncStream",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"ENVIRONMENTS",
|
|
64
|
+
"Nimble",
|
|
65
|
+
"AsyncNimble",
|
|
78
66
|
"file_from_path",
|
|
79
67
|
"BaseModel",
|
|
80
68
|
"DEFAULT_TIMEOUT",
|