Skip to content

Commit d6b3c89

Browse files
github-actions[bot]speakeasybotConiferish
authored
chore: 🐝 Update SDK - Generate (#58)
# SDK update Based on: - OpenAPI Doc 0.0.1 - Speakeasy CLI 1.204.1 (2.279.1) https://github.com/speakeasy-api/speakeasy ## PYTHON CHANGELOG ## responseFormat: 0.1.0 - 2024-03-02 ### 🐝 New Features - add support for response formats and flat responses *(commit by [@TristanSpeakEasy](https://github.com/TristanSpeakeasy))* ## core: 4.5.1 - 2024-03-06 ### 🐛 Bug Fixes - fixes to security header handling to be compatible with hooks *(commit by [@TristanSpeakEasy](https://github.com/tristanspeakeasy))* - fix py.typed file *(commit by [@ryan-timothy-albert](https://github.com/ryan-timothy-albert))* ## core: 4.4.7 - 2024-02-23 ### 🐛 Bug Fixes - example generation for complex objects *(commit by [@ThomasRooney](https://github.com/ThomasRooney))* --------- Co-authored-by: speakeasybot <[email protected]> Co-authored-by: John <[email protected]>
1 parent 6091d9e commit d6b3c89

File tree

12 files changed

+96
-94
lines changed

12 files changed

+96
-94
lines changed

Diff for: .speakeasy/gen.lock

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,30 @@ id: 8b5fa338-9106-4734-abf0-e30d67044a90
33
management:
44
docChecksum: 0474212adfef86a6c183841a3cb9d75b
55
docVersion: 0.0.1
6-
speakeasyVersion: internal
7-
generationVersion: 2.277.0
8-
releaseVersion: 0.21.1
9-
configChecksum: 37b07ca4ef319a1d49602f97748e7aba
6+
speakeasyVersion: 1.204.1
7+
generationVersion: 2.279.1
8+
releaseVersion: 0.22.0
9+
configChecksum: e458fc5426aa3514cb9bd40351fff33a
1010
repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git
1111
repoSubDirectory: .
1212
installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git
1313
published: true
1414
features:
1515
python:
16-
core: 4.5.0
16+
core: 4.5.1
1717
examples: 2.81.3
1818
globalSecurity: 2.83.4
1919
globalServerURLs: 2.82.1
2020
nameOverrides: 2.81.1
21+
responseFormat: 0.1.0
2122
retries: 2.82.1
2223
serverIDs: 2.81.1
2324
unions: 2.82.6
2425
generatedFiles:
2526
- src/unstructured_client/sdkconfiguration.py
2627
- src/unstructured_client/general.py
2728
- src/unstructured_client/sdk.py
29+
- py.typed
2830
- pylintrc
2931
- setup.py
3032
- src/unstructured_client/__init__.py
@@ -51,7 +53,6 @@ generatedFiles:
5153
- docs/models/shared/security.md
5254
- USAGE.md
5355
- .gitattributes
54-
- src/unstructured_client/_hooks/registration.py
5556
- src/unstructured_client/_hooks/sdkhooks.py
5657
- src/unstructured_client/_hooks/types.py
5758
- src/unstructured_client/_hooks/__init__.py

Diff for: RELEASES.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,14 @@ Based on:
464464
### Generated
465465
- [python v0.21.1] .
466466
### Releases
467-
- [PyPI v0.21.1] https://pypi.org/project/unstructured-client/0.21.1 - .
467+
- [PyPI v0.21.1] https://pypi.org/project/unstructured-client/0.21.1 - .
468+
469+
## 2024-03-08 00:19:03
470+
### Changes
471+
Based on:
472+
- OpenAPI Doc 0.0.1
473+
- Speakeasy CLI 1.204.1 (2.279.1) https://github.com/speakeasy-api/speakeasy
474+
### Generated
475+
- [python v0.22.0] .
476+
### Releases
477+
- [PyPI v0.22.0] https://pypi.org/project/unstructured-client/0.22.0 - .

Diff for: USAGE.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ res = s.general.partition(req)
3737
if res.elements is not None:
3838
# handle response
3939
pass
40+
4041
```
4142
<!-- End SDK Example Usage [usage] -->

Diff for: gen.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ generation:
1010
auth:
1111
oAuth2ClientCredentialsEnabled: false
1212
python:
13-
version: 0.21.1
13+
version: 0.22.0
1414
additionalDependencies:
1515
dependencies:
1616
deepdiff: '>=6.0'
@@ -34,3 +34,4 @@ python:
3434
maxMethodParams: 0
3535
outputModelSuffix: output
3636
packageName: unstructured-client
37+
responseFormat: envelope

Diff for: py.typed

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Marker file for PEP 561. The package enables type hints.

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setuptools.setup(
1212
name="unstructured-client",
13-
version="0.21.1",
13+
version="0.22.0",
1414
author="Unstructured",
1515
description="Python Client SDK for Unstructured API",
1616
license = "MIT",

Diff for: src/unstructured_client/_hooks/sdkhooks.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77

88

99
class SDKHooks(Hooks):
10-
sdk_init_hooks: List[SDKInitHook] = []
11-
before_request_hooks: List[BeforeRequestHook] = []
12-
after_success_hooks: List[AfterSuccessHook] = []
13-
after_error_hooks: List[AfterErrorHook] = []
14-
1510
def __init__(self):
11+
self.sdk_init_hooks: List[SDKInitHook] = []
12+
self.before_request_hooks: List[BeforeRequestHook] = []
13+
self.after_success_hooks: List[AfterSuccessHook] = []
14+
self.after_error_hooks: List[AfterErrorHook] = []
1615
init_hooks(self)
1716

1817
def register_sdk_init_hook(self, hook: SDKInitHook) -> None:

Diff for: src/unstructured_client/general.py

+18-14
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ def partition(self, request: Optional[shared.PartitionParameters], retries: Opti
2424
base_url = utils.template_url(*self.sdk_configuration.get_server_details())
2525

2626
url = base_url + '/general/v0/general'
27-
headers = {}
27+
28+
if callable(self.sdk_configuration.security):
29+
headers, query_params = utils.get_security(self.sdk_configuration.security())
30+
else:
31+
headers, query_params = utils.get_security(self.sdk_configuration.security)
32+
2833
req_content_type, data, form = utils.serialize_request_body(request, Optional[shared.PartitionParameters], "request", False, True, 'multipart')
2934
if req_content_type is not None and req_content_type not in ('multipart/form-data', 'multipart/mixed'):
3035
headers['content-type'] = req_content_type
3136
headers['Accept'] = 'application/json'
3237
headers['user-agent'] = self.sdk_configuration.user_agent
33-
34-
if callable(self.sdk_configuration.security):
35-
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security())
36-
else:
37-
client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security)
38-
38+
client = self.sdk_configuration.client
3939

4040
global_retry_config = self.sdk_configuration.retry_config
4141
retry_config = retries
@@ -45,11 +45,13 @@ def partition(self, request: Optional[shared.PartitionParameters], retries: Opti
4545
else:
4646
retry_config = utils.RetryConfig('backoff', utils.BackoffStrategy(500, 60000, 1.5, 900000), True)
4747

48+
req = None
4849
def do_request():
50+
nonlocal req
4951
try:
5052
req = self.sdk_configuration.get_hooks().before_request(
5153
hook_ctx,
52-
requests_http.Request('POST', url, data=data, files=form, headers=headers).prepare(),
54+
requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
5355
)
5456
http_res = client.send(req)
5557
except Exception as e:
@@ -72,26 +74,28 @@ def do_request():
7274
'5xx'
7375
]))
7476

75-
content_type = http_res.headers.get('Content-Type')
7677

77-
res = operations.PartitionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res)
78+
res = operations.PartitionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
7879

7980
if http_res.status_code == 200:
80-
if utils.match_content_type(content_type, 'application/json'):
81+
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
8182
out = utils.unmarshal_json(http_res.text, Optional[List[Any]])
8283
res.elements = out
8384
else:
85+
content_type = http_res.headers.get('Content-Type')
8486
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
8587
elif http_res.status_code == 422:
86-
if utils.match_content_type(content_type, 'application/json'):
88+
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
8789
out = utils.unmarshal_json(http_res.text, errors.HTTPValidationError)
88-
out.raw_response = http_res
8990
raise out
9091
else:
92+
content_type = http_res.headers.get('Content-Type')
9193
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
9294
elif http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
9395
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
96+
else:
97+
raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
9498

9599
return res
96100

97-
101+

Diff for: src/unstructured_client/sdk.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from unstructured_client.models import shared
1010
from unstructured_client.utils._human_utils import clean_server_url # human code
1111

12-
1312
class UnstructuredClient:
1413
r"""Unstructured Pipeline API: Partition documents with the Unstructured library"""
1514
general: General
@@ -69,3 +68,4 @@ def security():
6968

7069
def _init_sdks(self):
7170
self.general = General(self.sdk_configuration)
71+

Diff for: src/unstructured_client/sdkconfiguration.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class SDKConfiguration:
2929
server: str = ''
3030
language: str = 'python'
3131
openapi_doc_version: str = '0.0.1'
32-
sdk_version: str = '0.21.1'
33-
gen_version: str = '2.277.0'
34-
user_agent: str = 'speakeasy-sdk/python 0.21.1 2.277.0 0.0.1 unstructured-client'
32+
sdk_version: str = '0.22.0'
33+
gen_version: str = '2.279.1'
34+
user_agent: str = 'speakeasy-sdk/python 0.22.0 2.279.1 0.0.1 unstructured-client'
3535
retry_config: RetryConfig = None
3636
_hooks: SDKHooks = None
3737

Diff for: src/unstructured_client/utils/retries.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from unstructured_client.utils._human_utils import log_retries # human code
1010

11-
1211
class BackoffStrategy:
1312
initial_interval: int
1413
max_interval: int
@@ -121,3 +120,4 @@ def retry_with_backoff(func, initial_interval=500, max_interval=60000, exponent=
121120
log_retries(retry_count=retries+1, sleep=sleep, exception=exception) # human code
122121
time.sleep(sleep)
123122
retries += 1
123+

0 commit comments

Comments
 (0)