Skip to content

Commit

Permalink
chore: 🐝 Update SDK - Generate (#57)
Browse files Browse the repository at this point in the history
# 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 <[email protected]>
Co-authored-by: hubert.rutkowski <[email protected]>
  • Loading branch information
3 people authored Mar 5, 2024
1 parent 6ab44e9 commit 6091d9e
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 16 deletions.
7 changes: 4 additions & 3 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 - .
- [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 - .
4 changes: 2 additions & 2 deletions gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": [
Expand Down
1 change: 1 addition & 0 deletions src/unstructured_client/_hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

from .sdkhooks import *
from .types import *
from .registration import *
13 changes: 13 additions & 0 deletions src/unstructured_client/_hooks/registration.py
Original file line number Diff line number Diff line change
@@ -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"""
3 changes: 2 additions & 1 deletion src/unstructured_client/_hooks/sdkhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/unstructured_client/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -94,3 +94,4 @@ def do_request():

return res


2 changes: 1 addition & 1 deletion src/unstructured_client/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,4 +69,3 @@ def security():

def _init_sdks(self):
self.general = General(self.sdk_configuration)

4 changes: 2 additions & 2 deletions src/unstructured_client/sdkconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6091d9e

Please sign in to comment.