You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements.
4
+
5
+
## How to Report Issues
6
+
7
+
If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes:
8
+
9
+
- A clear and descriptive title
10
+
- Steps to reproduce the issue
11
+
- Expected and actual behavior
12
+
- Any relevant logs, screenshots, or error messages
13
+
- Information about your environment (e.g., operating system, software versions)
14
+
- For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed
15
+
16
+
## Issue Triage and Upstream Fixes
17
+
18
+
We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code.
19
+
20
+
## Contact
21
+
22
+
If you have any questions or need further assistance, please feel free to reach out by opening an issue.
@@ -148,29 +155,30 @@ if res.elements is not None:
148
155
149
156
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
150
157
```python
151
-
import unstructured_client
152
-
from unstructured_client.models importoperations, shared
158
+
from unstructured_clientimport UnstructuredClient
159
+
from unstructured_client.models import shared
153
160
from unstructured_client.utils import BackoffStrategy, RetryConfig
@@ -182,16 +190,81 @@ if res.elements is not None:
182
190
<!-- Start Custom HTTP Client [http-client] -->
183
191
## Custom HTTP Client
184
192
185
-
The Python SDK makes API calls using the [requests](https://pypi.org/project/requests/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `requests.Session` object.
193
+
The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
194
+
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
195
+
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
186
196
187
197
For example, you could specify a header for every request that this sdk makes as follows:
188
198
```python
189
-
import unstructured_client
190
-
import requests
199
+
from unstructured_client import UnstructuredClient
s = UnstructuredClient(async_client=CustomClient(httpx.AsyncClient()))
195
268
```
196
269
<!-- End Custom HTTP Client [http-client] -->
197
270
@@ -202,6 +275,47 @@ s = unstructured_client.UnstructuredClient(client=http_client)
202
275
<!-- No Server Selection -->
203
276
<!-- No Authentication -->
204
277
278
+
<!-- Start File uploads [file-upload] -->
279
+
## File uploads
280
+
281
+
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
282
+
283
+
> [!TIP]
284
+
>
285
+
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
286
+
>
287
+
288
+
```python
289
+
from unstructured_client import UnstructuredClient
0 commit comments