File tree 1 file changed +14
-8
lines changed
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
30
30
``` python
31
31
from unstructured_client import UnstructuredClient
32
32
from unstructured_client.models import shared
33
+ from unstructured_client.models.errors import SDKError
33
34
34
35
# Note - in an upcoming release, the Security object is removed
35
36
# You'll pass the api key directly
@@ -40,17 +41,22 @@ s = UnstructuredClient(
40
41
)
41
42
42
43
filename = " sample-docs/layout-parser-paper.pdf"
44
+ file = open (filename, " rb" )
43
45
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 :
52
56
res = s.general.partition(req)
53
57
print (res.elements[0 ])
58
+ except SDKError as e:
59
+ print (e)
54
60
55
61
# {
56
62
# 'type': 'Title',
You can’t perform that action at this time.
0 commit comments