55 >
66 </h3>
77
8- # unstructured-client
9-
10- <div align =" left " >
8+ <div align =" center " >
119 <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>
1210 <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-
1411</div >
1512
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+
1719<!-- Start SDK Installation -->
1820## SDK Installation
1921
@@ -22,78 +24,57 @@ pip install unstructured-client
2224```
2325<!-- End SDK Installation -->
2426
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+
2730``` python
28- import unstructured_client
31+ from unstructured_client import UnstructuredClient
2932from unstructured_client.models import shared
3033
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(
3237 security = shared.Security(
3338 api_key_auth = " YOUR_API_KEY" ,
3439 ),
3540)
3641
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"
5843
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)
6053
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
6356```
64- <!-- End SDK Example Usage -->
65-
66- <!-- Start SDK Available Operations -->
67- ## Available Resources and Operations
6857
58+ ## Change the base URL
6959
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.
7161
72- * [ partition ] ( docs/sdks/general/README.md#partition ) - Pipeline 1
73- <!-- End SDK Available Operations -->
62+ ``` python
63+ s = UnstructuredClient()
7464
65+ # Using a local server
66+ s.config_server_url(" http://localhost:8000" )
7567
68+ # Using your own server
69+ s.config_server_url(" https://my-hosted-api" )
70+ ```
7671
7772<!-- Start Dev Containers -->
7873
7974<!-- End Dev Containers -->
8075
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-
9376<!-- Placeholder for Future Speakeasy SDK Sections -->
9477
95-
96-
9778### Maturity
9879
9980This 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