Skip to content

Commit

Permalink
chore: 🐝 Update SDK - Generate 0.26.2 (#199)
Browse files Browse the repository at this point in the history
> [!IMPORTANT]
> Linting report available at:
<https://app.speakeasy.com/org/unstructured/unstructured5xr/linting-report/9c325105dfa290a8755df12c901712d0>
> OpenAPI Change report available at:
<https://app.speakeasy.com/org/unstructured/unstructured5xr/changes-report/09e885b005e165e9aa40a7d4a7b03a69>
# SDK update
Based on:
- OpenAPI Doc  
- Speakeasy CLI 1.422.1 (2.438.15)
https://github.com/speakeasy-api/speakeasy
## OpenAPI Change Summary
No specification changes

Co-authored-by: speakeasybot <[email protected]>
  • Loading branch information
github-actions[bot] and speakeasybot authored Oct 28, 2024
1 parent 4d07f22 commit 99c6385
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ id: 8b5fa338-9106-4734-abf0-e30d67044a90
management:
docChecksum: 21f469b38bb72725739ee9d9d0fc8780
docVersion: 1.0.51
speakeasyVersion: 1.418.1
generationVersion: 2.438.3
releaseVersion: 0.26.1
configChecksum: 55ded3ef4f1b052725cdab6587da0ea4
speakeasyVersion: 1.422.1
generationVersion: 2.438.15
releaseVersion: 0.26.2
configChecksum: c46fa7f108a08d4565530aa29da677b5
repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git
repoSubDirectory: .
installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git
Expand Down
6 changes: 3 additions & 3 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
speakeasyVersion: 1.418.1
speakeasyVersion: 1.422.1
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:a820d523af3e56f0dd1fc84f4f29e15330edb26cc253e93981bddb4a5176ac3c
sourceRevisionDigest: sha256:31c94056ebc941cdfcf3fd4ba5e04880e978740963f7ce79169ba66cd033d74d
sourceBlobDigest: sha256:27e4879df402e924f9f65d336ea6d2fc8b16a00b87b4a802866238f7e9f639d3
tags:
- latest
Expand All @@ -11,7 +11,7 @@ targets:
unstructured-python:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:a820d523af3e56f0dd1fc84f4f29e15330edb26cc253e93981bddb4a5176ac3c
sourceRevisionDigest: sha256:31c94056ebc941cdfcf3fd4ba5e04880e978740963f7ce79169ba66cd033d74d
sourceBlobDigest: sha256:27e4879df402e924f9f65d336ea6d2fc8b16a00b87b4a802866238f7e9f639d3
workflow:
workflowVersion: 1.0.0
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -704,4 +704,14 @@ Based on:
### Generated
- [python v0.26.1] .
### Releases
- [PyPI v0.26.1] https://pypi.org/project/unstructured-client/0.26.1 - .
- [PyPI v0.26.1] https://pypi.org/project/unstructured-client/0.26.1 - .

## 2024-10-28 00:09:56
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.422.1 (2.438.15) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.26.2] .
### Releases
- [PyPI v0.26.2] https://pypi.org/project/unstructured-client/0.26.2 - .
2 changes: 1 addition & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
python:
version: 0.26.1
version: 0.26.2
additionalDependencies:
dev:
deepdiff: '>=6.0'
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "unstructured-client"
version = "0.26.1"
version = "0.26.2"
description = "Python Client SDK for Unstructured API"
authors = ["Unstructured",]
readme = "README-PYPI.md"
Expand Down
2 changes: 1 addition & 1 deletion src/unstructured_client/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import importlib.metadata

__title__: str = "unstructured-client"
__version__: str = "0.26.1"
__version__: str = "0.26.2"

try:
if __package__ is not None:
Expand Down
12 changes: 8 additions & 4 deletions src/unstructured_client/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,20 @@ def partition(
data = utils.unmarshal_json(http_res.text, errors.HTTPValidationErrorData)
raise errors.HTTPValidationError(data=data)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = utils.stream_to_text(http_res)
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
"API error occurred", http_res.status_code, http_res_text, http_res
)
if utils.match_response(http_res, "5XX", "application/json"):
data = utils.unmarshal_json(http_res.text, errors.ServerErrorData)
raise errors.ServerError(data=data)

content_type = http_res.headers.get("Content-Type")
http_res_text = utils.stream_to_text(http_res)
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res_text,
http_res,
)

Expand Down Expand Up @@ -204,17 +206,19 @@ async def partition_async(
data = utils.unmarshal_json(http_res.text, errors.HTTPValidationErrorData)
raise errors.HTTPValidationError(data=data)
if utils.match_response(http_res, "4XX", "*"):
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.SDKError(
"API error occurred", http_res.status_code, http_res.text, http_res
"API error occurred", http_res.status_code, http_res_text, http_res
)
if utils.match_response(http_res, "5XX", "application/json"):
data = utils.unmarshal_json(http_res.text, errors.ServerErrorData)
raise errors.ServerError(data=data)

content_type = http_res.headers.get("Content-Type")
http_res_text = await utils.stream_to_text_async(http_res)
raise errors.SDKError(
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
http_res.status_code,
http_res.text,
http_res_text,
http_res,
)
6 changes: 3 additions & 3 deletions src/unstructured_client/sdkconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class SDKConfiguration:
server: Optional[str] = ""
language: str = "python"
openapi_doc_version: str = "1.0.51"
sdk_version: str = "0.26.1"
gen_version: str = "2.438.3"
user_agent: str = "speakeasy-sdk/python 0.26.1 2.438.3 1.0.51 unstructured-client"
sdk_version: str = "0.26.2"
gen_version: str = "2.438.15"
user_agent: str = "speakeasy-sdk/python 0.26.2 2.438.15 1.0.51 unstructured-client"
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
timeout_ms: Optional[int] = None

Expand Down
6 changes: 6 additions & 0 deletions src/unstructured_client/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
serialize_float,
serialize_int,
stream_to_text,
stream_to_text_async,
stream_to_bytes,
stream_to_bytes_async,
validate_const,
validate_decimal,
validate_float,
Expand Down Expand Up @@ -80,6 +83,9 @@
"serialize_request_body",
"SerializedRequestBody",
"stream_to_text",
"stream_to_text_async",
"stream_to_bytes",
"stream_to_bytes_async",
"template_url",
"unmarshal",
"unmarshal_json",
Expand Down
12 changes: 12 additions & 0 deletions src/unstructured_client/utils/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ def stream_to_text(stream: httpx.Response) -> str:
return "".join(stream.iter_text())


async def stream_to_text_async(stream: httpx.Response) -> str:
return "".join([chunk async for chunk in stream.aiter_text()])


def stream_to_bytes(stream: httpx.Response) -> bytes:
return stream.content


async def stream_to_bytes_async(stream: httpx.Response) -> bytes:
return await stream.aread()


def get_pydantic_model(data: Any, typ: Any) -> Any:
if not _contains_pydantic_model(data):
return unmarshal(data, typ)
Expand Down

0 comments on commit 99c6385

Please sign in to comment.