From 6091d9ec5b4b5dde525d264e9f1978dfe109ca70 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 23:50:39 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=90=9D=20Update=20SDK=20-=20Gene?= =?UTF-8?q?rate=20(#57)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # SDK update Based on: - OpenAPI Doc 0.0.1 - Speakeasy CLI 1.201.1 (2.277.0) https://github.com/speakeasy-api/speakeasy ## PYTHON CHANGELOG --------- Co-authored-by: speakeasybot Co-authored-by: hubert.rutkowski --- .speakeasy/gen.lock | 7 ++++--- RELEASES.md | 12 +++++++++++- gen.yaml | 4 ++-- setup.py | 6 +++--- src/unstructured_client/_hooks/__init__.py | 1 + src/unstructured_client/_hooks/registration.py | 13 +++++++++++++ src/unstructured_client/_hooks/sdkhooks.py | 3 ++- src/unstructured_client/general.py | 7 ++++--- src/unstructured_client/sdk.py | 2 +- src/unstructured_client/sdkconfiguration.py | 4 ++-- 10 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 src/unstructured_client/_hooks/registration.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 50da82b7..9076896c 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 8b5fa338-9106-4734-abf0-e30d67044a90 management: - docChecksum: a112aea005467aa6818696fa4e99fcfe + docChecksum: 0474212adfef86a6c183841a3cb9d75b docVersion: 0.0.1 speakeasyVersion: internal generationVersion: 2.277.0 - releaseVersion: 0.21.0 - configChecksum: c5e7c8526f43272d7585627468d8c4e5 + releaseVersion: 0.21.1 + configChecksum: 37b07ca4ef319a1d49602f97748e7aba repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git repoSubDirectory: . installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git @@ -51,6 +51,7 @@ generatedFiles: - docs/models/shared/security.md - USAGE.md - .gitattributes + - src/unstructured_client/_hooks/registration.py - src/unstructured_client/_hooks/sdkhooks.py - src/unstructured_client/_hooks/types.py - src/unstructured_client/_hooks/__init__.py diff --git a/RELEASES.md b/RELEASES.md index 93856bc2..af8d0153 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -454,4 +454,14 @@ Based on: ### Generated - [python v0.21.0] . ### Releases -- [PyPI v0.21.0] https://pypi.org/project/unstructured-client/0.21.0 - . \ No newline at end of file +- [PyPI v0.21.0] https://pypi.org/project/unstructured-client/0.21.0 - . + +## 2024-03-05 22:38:33 +### Changes +Based on: +- OpenAPI Doc 0.0.1 +- Speakeasy CLI 1.201.1 (2.277.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.21.1] . +### Releases +- [PyPI v0.21.1] https://pypi.org/project/unstructured-client/0.21.1 - . \ No newline at end of file diff --git a/gen.yaml b/gen.yaml index 4ac59bd5..cbcdef5f 100644 --- a/gen.yaml +++ b/gen.yaml @@ -10,11 +10,11 @@ generation: auth: oAuth2ClientCredentialsEnabled: false python: - version: 0.21.0 + version: 0.21.1 additionalDependencies: dependencies: - pypdf: '>=4.0' deepdiff: '>=6.0' + pypdf: '>=4.0' extraDependencies: dev: {} author: Unstructured diff --git a/setup.py b/setup.py index de7dc9d3..de7e065f 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setuptools.setup( name="unstructured-client", - version="0.21.0", + version="0.21.1", author="Unstructured", description="Python Client SDK for Unstructured API", license = "MIT", @@ -21,19 +21,19 @@ "certifi>=2023.7.22", "charset-normalizer>=3.2.0", "dataclasses-json>=0.6.4", + "deepdiff>=6.0", "idna>=3.4", "jsonpath-python>=1.0.6", "marshmallow>=3.19.0", "mypy-extensions>=1.0.0", "packaging>=23.1", + "pypdf>=4.0", "python-dateutil>=2.8.2", "requests>=2.31.0", "six>=1.16.0", "typing-inspect>=0.9.0", "typing_extensions>=4.7.1", "urllib3>=1.26.18", - "pypdf>=4.0", # human code - "deepdiff>=6.0", # human code ], extras_require={ "dev": [ diff --git a/src/unstructured_client/_hooks/__init__.py b/src/unstructured_client/_hooks/__init__.py index b2ab14b3..5fd985a8 100644 --- a/src/unstructured_client/_hooks/__init__.py +++ b/src/unstructured_client/_hooks/__init__.py @@ -2,3 +2,4 @@ from .sdkhooks import * from .types import * +from .registration import * diff --git a/src/unstructured_client/_hooks/registration.py b/src/unstructured_client/_hooks/registration.py new file mode 100644 index 00000000..1db6a529 --- /dev/null +++ b/src/unstructured_client/_hooks/registration.py @@ -0,0 +1,13 @@ +from .types import Hooks + + +# This file is only ever generated once on the first generation and then is free to be modified. +# Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them +# in this file or in separate files in the hooks folder. + + +def init_hooks(hooks: Hooks): + # pylint: disable=unused-argument + """Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook + with an instance of a hook that implements that specific Hook interface + Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance""" diff --git a/src/unstructured_client/_hooks/sdkhooks.py b/src/unstructured_client/_hooks/sdkhooks.py index a8f9a583..a9ba878f 100644 --- a/src/unstructured_client/_hooks/sdkhooks.py +++ b/src/unstructured_client/_hooks/sdkhooks.py @@ -2,6 +2,7 @@ import requests from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks +from .registration import init_hooks from typing import List, Optional, Tuple, Union @@ -12,7 +13,7 @@ class SDKHooks(Hooks): after_error_hooks: List[AfterErrorHook] = [] def __init__(self): - pass + init_hooks(self) def register_sdk_init_hook(self, hook: SDKInitHook) -> None: self.sdk_init_hooks.append(hook) diff --git a/src/unstructured_client/general.py b/src/unstructured_client/general.py index 1761a512..c22c70f4 100644 --- a/src/unstructured_client/general.py +++ b/src/unstructured_client/general.py @@ -36,7 +36,7 @@ def partition(self, request: Optional[shared.PartitionParameters], retries: Opti else: client = utils.configure_security_client(self.sdk_configuration.client, self.sdk_configuration.security) - + global_retry_config = self.sdk_configuration.retry_config retry_config = retries if retry_config is None: @@ -48,7 +48,7 @@ def partition(self, request: Optional[shared.PartitionParameters], retries: Opti def do_request(): try: req = self.sdk_configuration.get_hooks().before_request( - hook_ctx, + hook_ctx, requests_http.Request('POST', url, data=data, files=form, headers=headers).prepare(), ) http_res = client.send(req) @@ -71,7 +71,7 @@ def do_request(): http_res = utils.retry(do_request, utils.Retries(retry_config, [ '5xx' ])) - + content_type = http_res.headers.get('Content-Type') res = operations.PartitionResponse(status_code=http_res.status_code, content_type=content_type, raw_response=http_res) @@ -94,3 +94,4 @@ def do_request(): return res + \ No newline at end of file diff --git a/src/unstructured_client/sdk.py b/src/unstructured_client/sdk.py index 4dd9b7ba..c2da04cd 100644 --- a/src/unstructured_client/sdk.py +++ b/src/unstructured_client/sdk.py @@ -9,6 +9,7 @@ from unstructured_client.models import shared from unstructured_client.utils._human_utils import clean_server_url # human code + class UnstructuredClient: r"""Unstructured Pipeline API: Partition documents with the Unstructured library""" general: General @@ -68,4 +69,3 @@ def security(): def _init_sdks(self): self.general = General(self.sdk_configuration) - diff --git a/src/unstructured_client/sdkconfiguration.py b/src/unstructured_client/sdkconfiguration.py index 573e64c9..28d277b7 100644 --- a/src/unstructured_client/sdkconfiguration.py +++ b/src/unstructured_client/sdkconfiguration.py @@ -29,9 +29,9 @@ class SDKConfiguration: server: str = '' language: str = 'python' openapi_doc_version: str = '0.0.1' - sdk_version: str = '0.21.0' + sdk_version: str = '0.21.1' gen_version: str = '2.277.0' - user_agent: str = 'speakeasy-sdk/python 0.21.0 2.277.0 0.0.1 unstructured-client' + user_agent: str = 'speakeasy-sdk/python 0.21.1 2.277.0 0.0.1 unstructured-client' retry_config: RetryConfig = None _hooks: SDKHooks = None