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
Copy file name to clipboardExpand all lines: README.md
+44-23Lines changed: 44 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,26 +153,18 @@ with UnstructuredClient(
153
153
<!-- Start Error Handling [errors] -->
154
154
## Error Handling
155
155
156
-
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
156
+
[`UnstructuredClientError`](./src/unstructured_client/models/errors/unstructuredclienterror.py) is the base class for all HTTP error responses. It has the following properties:
157
157
158
-
By default, an API error will raise a errors.SDKError exception, which has the following properties:
|`.raw_response`|*httpx.Response*| The raw HTTP response |
165
-
|`.body`|*str*| The response content |
166
-
167
-
When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `create_connection_check_destinations_async` method may raise the following exceptions:
**Inherit from [`UnstructuredClientError`](./src/unstructured_client/models/errors/unstructuredclienterror.py)**:
216
+
*[`ServerError`](./src/unstructured_client/models/errors/servererror.py): Server Error. Status code `5XX`. Applicable to 1 of 29 methods.*
217
+
*[`ResponseValidationError`](./src/unstructured_client/models/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
218
+
219
+
</details>
220
+
221
+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
"source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.users.retrieve(request={})\n\n assert res.pem_auth_response is not None\n\n # Handle response\n print(res.pem_auth_response)"
"source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.users.get_encryption_certificate(request={})\n\n assert res.encryption_certificate_response is not None\n\n # Handle response\n print(res.encryption_certificate_response)"
138
138
- target: $["paths"]["/api/v1/workflows/"]["get"]
139
139
update:
140
140
"x-codeSamples":
@@ -176,4 +176,4 @@ actions:
176
176
"x-codeSamples":
177
177
- "lang": "python"
178
178
"label": "partition"
179
-
"source": "from unstructured_client import UnstructuredClient\nfrom unstructured_client.models import shared\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.general.partition(request={\n\"partition_parameters\": {\n\"files\": {\n\"file_name\": \"example.file\",\n\"content\": open(\"example.file\", \"rb\"),\n },\n\"vlm_model_provider\": shared.VLMModelProvider.OPENAI,\n\"vlm_model\": shared.VLMModel.GPT_4O,\n\"split_pdf_page_range\": [\n 1,\n 10,\n ],\n },\n })\n\n assert res.elements is not None\n\n # Handle response\n print(res.elements)"
179
+
"source": "from unstructured_client import UnstructuredClient\nfrom unstructured_client.models import shared\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.general.partition(request={\n\"partition_parameters\": {\n\"files\": {\n\"file_name\": \"example.file\",\n\"content\": open(\"example.file\", \"rb\"),\n },\n\"strategy\": shared.Strategy.AUTO,\n\"vlm_model_provider\": shared.VLMModelProvider.OPENAI,\n\"vlm_model\": shared.VLMModel.GPT_4O,\n\"chunking_strategy\": \"by_title\",\n\"split_pdf_page_range\": [\n 1,\n 10,\n ],\n\"split_pdf_cache_tmp_data_dir\": \"<value>\",\n },\n })\n\n assert res.elements is not None\n\n # Handle response\n print(res.elements)"
0 commit comments