5
5
>
6
6
</h3>
7
7
8
- # unstructured-client
9
-
10
- <div align =" left " >
8
+ <div align =" center " >
11
9
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
12
10
<a href="https://github.com/Unstructured-IO/unstructured-client.git/actions"><img src="https://img.shields.io/github/actions/workflow/status/speakeasy-sdks/bolt-php/speakeasy_sdk_generation.yml?style=for-the-badge" /></a>
13
-
14
11
</div >
15
12
16
- Not ready for primetime yet - come back soon!
13
+ <h2 align =" center " >
14
+ <p >Python SDK for the Unstructured API</p >
15
+ </h2 >
16
+
17
+ This is a Python client for the [ Unstructured API] ( https://unstructured-io.github.io/unstructured/api.html ) .
18
+
17
19
<!-- Start SDK Installation -->
18
20
## SDK Installation
19
21
@@ -22,78 +24,57 @@ pip install unstructured-client
22
24
```
23
25
<!-- End SDK Installation -->
24
26
25
- ## SDK Example Usage
26
- <!-- Start SDK Example Usage -->
27
+ ## Usage
28
+ Only the ` files ` parameter is required. See the [ general partition] ( [General](docs/sdks/general/README.md) ) page for all available parameters.
29
+
27
30
``` python
28
- import unstructured_client
31
+ from unstructured_client import UnstructuredClient
29
32
from unstructured_client.models import shared
30
33
31
- s = unstructured_client.UnstructuredClient(
34
+ # Note - in an upcoming release, the Security object is removed
35
+ # You'll pass the api key directly
36
+ s = UnstructuredClient(
32
37
security = shared.Security(
33
38
api_key_auth = " YOUR_API_KEY" ,
34
39
),
35
40
)
36
41
37
- req = shared.PartitionParameters(
38
- coordinates = False ,
39
- encoding = ' utf-8' ,
40
- files = shared.PartitionParametersFiles(
41
- content = ' distinctio' .encode(),
42
- files = ' quibusdam' ,
43
- ),
44
- gz_uncompressed_content_type = ' application/pdf' ,
45
- hi_res_model_name = ' yolox' ,
46
- include_page_breaks = False ,
47
- ocr_languages = [
48
- ' eng' ,
49
- ],
50
- output_format = ' application/json' ,
51
- pdf_infer_table_structure = False ,
52
- skip_infer_table_types = [
53
- ' pdf' ,
54
- ],
55
- strategy = ' hi_res' ,
56
- xml_keep_tags = False ,
57
- )
42
+ filename = " /path/to/document"
58
43
59
- res = s.general.partition(req)
44
+ with open (filename, " rb" ) as f:
45
+ req = shared.PartitionParameters(
46
+ files = shared.PartitionParametersFiles(
47
+ content = f.read(),
48
+ files = filename,
49
+ )
50
+ )
51
+
52
+ res = s.general.partition(req)
60
53
61
- if res.partition_200_application_json_any is not None :
62
- # handle response
54
+ if res.partition_200_application_json_any is not None :
55
+ # handle response
63
56
```
64
- <!-- End SDK Example Usage -->
65
-
66
- <!-- Start SDK Available Operations -->
67
- ## Available Resources and Operations
68
57
58
+ ## Change the base URL
69
59
70
- ### [ General ] ( docs/sdks/general/README.md )
60
+ If you are self hosting the API, or developing locally, you can change the server URL when setting up the client.
71
61
72
- * [ partition ] ( docs/sdks/general/README.md#partition ) - Pipeline 1
73
- <!-- End SDK Available Operations -->
62
+ ``` python
63
+ s = UnstructuredClient()
74
64
65
+ # Using a local server
66
+ s.config_server_url(" http://localhost:8000" )
75
67
68
+ # Using your own server
69
+ s.config_server_url(" https://my-hosted-api" )
70
+ ```
76
71
77
72
<!-- Start Dev Containers -->
78
73
79
74
<!-- End Dev Containers -->
80
75
81
-
82
-
83
- <!-- Start Pagination -->
84
- # Pagination
85
-
86
- Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
87
- returned response object will have a ` Next ` method that can be called to pull down the next group of results. If the
88
- return value of ` Next ` is ` None ` , then there are no more pages to be fetched.
89
-
90
- Here's an example of one such pagination call:
91
- <!-- End Pagination -->
92
-
93
76
<!-- Placeholder for Future Speakeasy SDK Sections -->
94
77
95
-
96
-
97
78
### Maturity
98
79
99
80
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
0 commit comments