File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ Only the `files` parameter is required. See the [general partition](docs/sdks/ge
3030``` python
3131from unstructured_client import UnstructuredClient
3232from unstructured_client.models import shared
33+ from unstructured_client.models.errors import SDKError
3334
3435# Note - in an upcoming release, the Security object is removed
3536# You'll pass the api key directly
@@ -40,17 +41,22 @@ s = UnstructuredClient(
4041)
4142
4243filename = " sample-docs/layout-parser-paper.pdf"
44+ file = open (filename, " rb" )
4345
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-
46+ req = shared.PartitionParameters(
47+ files = shared.PartitionParametersFiles(
48+ content = file .read(),
49+ files = filename,
50+ ),
51+ # Other partition params
52+ strategy = " fast" ,
53+ )
54+
55+ try :
5256 res = s.general.partition(req)
5357 print (res.elements[0 ])
58+ except SDKError as e:
59+ print (e)
5460
5561# {
5662# 'type': 'Title',
You can’t perform that action at this time.
0 commit comments