Skip to content

Commit d259d6f

Browse files
authored
Merge pull request #26 from Unstructured-IO/speakeasy-sdk-regen-1705018777
chore: 🐝 Update SDK - Generate
2 parents f671939 + b9386f1 commit d259d6f

File tree

8 files changed

+69
-22
lines changed

8 files changed

+69
-22
lines changed

Diff for: .speakeasy/gen.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ management:
44
docChecksum: 559aacf6828c62bd379326645382b3ba
55
docVersion: 0.0.1
66
speakeasyVersion: internal
7-
generationVersion: 2.230.1
8-
releaseVersion: 0.15.2
9-
configChecksum: c7f5587d10f16ad71c809e8627e64175
7+
generationVersion: 2.237.2
8+
releaseVersion: 0.15.5
9+
configChecksum: 5138d0e0d09d018eeec74356c4b3fef5
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.4.1
16+
core: 4.4.2
1717
examples: 2.81.3
18-
globalSecurity: 2.83.1
18+
globalSecurity: 2.83.2
1919
globalServerURLs: 2.82.1
2020
nameOverrides: 2.81.1
21-
retries: 2.82.0
21+
retries: 2.82.1
2222
serverIDs: 2.81.1
2323
unions: 2.82.5
2424
generatedFiles:

Diff for: RELEASES.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,44 @@ Based on:
344344
### Generated
345345
- [python v0.15.2] .
346346
### Releases
347-
- [PyPI v0.15.2] https://pypi.org/project/unstructured-client/0.15.2 - .
347+
- [PyPI v0.15.2] https://pypi.org/project/unstructured-client/0.15.2 - .
348+
349+
## 2024-01-12 00:19:36
350+
### Changes
351+
Based on:
352+
- OpenAPI Doc 0.0.1
353+
- Speakeasy CLI 1.136.1 (2.231.0) https://github.com/speakeasy-api/speakeasy
354+
### Generated
355+
- [python v0.15.2] .
356+
### Releases
357+
- [PyPI v0.15.2] https://pypi.org/project/unstructured-client/0.15.2 - .
358+
359+
## 2024-01-16 00:19:58
360+
### Changes
361+
Based on:
362+
- OpenAPI Doc 0.0.1
363+
- Speakeasy CLI 1.141.1 (2.233.2) https://github.com/speakeasy-api/speakeasy
364+
### Generated
365+
- [python v0.15.3] .
366+
### Releases
367+
- [PyPI v0.15.3] https://pypi.org/project/unstructured-client/0.15.3 - .
368+
369+
## 2024-01-17 00:19:51
370+
### Changes
371+
Based on:
372+
- OpenAPI Doc 0.0.1
373+
- Speakeasy CLI 1.142.1 (2.234.3) https://github.com/speakeasy-api/speakeasy
374+
### Generated
375+
- [python v0.15.4] .
376+
### Releases
377+
- [PyPI v0.15.4] https://pypi.org/project/unstructured-client/0.15.4 - .
378+
379+
## 2024-01-19 00:19:58
380+
### Changes
381+
Based on:
382+
- OpenAPI Doc 0.0.1
383+
- Speakeasy CLI 1.147.0 (2.237.2) https://github.com/speakeasy-api/speakeasy
384+
### Generated
385+
- [python v0.15.5] .
386+
### Releases
387+
- [PyPI v0.15.5] https://pypi.org/project/unstructured-client/0.15.5 - .

Diff for: gen.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ generation:
66
fixes:
77
nameResolutionDec2023: false
88
python:
9-
version: 0.15.2
9+
version: 0.15.5
1010
author: Unstructured
1111
clientServerStatusCodesAsErrors: true
1212
description: Python Client SDK for Unstructured API

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.15.2",
13+
version="0.15.5",
1414
author="Unstructured",
1515
description="Python Client SDK for Unstructured API",
1616
long_description=long_description,

Diff for: src/unstructured_client/sdk.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import requests as requests_http
44
from .general import General
55
from .sdkconfiguration import SDKConfiguration
6-
from typing import Dict
6+
from typing import Callable, Dict, Union
77
from unstructured_client import utils
88
from unstructured_client.models import shared
99

@@ -14,7 +14,7 @@ class UnstructuredClient:
1414
sdk_configuration: SDKConfiguration
1515

1616
def __init__(self,
17-
api_key_auth: str ,
17+
api_key_auth: Union[str, Callable[[], str]],
1818
server: str = None,
1919
server_url: str = None,
2020
url_params: Dict[str, str] = None,
@@ -24,7 +24,7 @@ def __init__(self,
2424
"""Instantiates the SDK configuring it with the provided parameters.
2525
2626
:param api_key_auth: The api_key_auth required for authentication
27-
:type api_key_auth: Union[str,Callable[[], str]]
27+
:type api_key_auth: Union[str, Callable[[], str]]
2828
:param server: The server by name to use for all operations
2929
:type server: str
3030
:param server_url: The server URL to use for all operations
@@ -39,7 +39,11 @@ def __init__(self,
3939
if client is None:
4040
client = requests_http.Session()
4141

42-
security = shared.Security(api_key_auth = api_key_auth)
42+
if callable(api_key_auth):
43+
def security():
44+
return shared.Security(api_key_auth = api_key_auth())
45+
else:
46+
security = shared.Security(api_key_auth = api_key_auth)
4347

4448
if server_url is not None:
4549
if url_params is not None:

Diff for: src/unstructured_client/sdkconfiguration.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class SDKConfiguration:
2727
server: str = ''
2828
language: str = 'python'
2929
openapi_doc_version: str = '0.0.1'
30-
sdk_version: str = '0.15.2'
31-
gen_version: str = '2.230.1'
32-
user_agent: str = 'speakeasy-sdk/python 0.15.2 2.230.1 0.0.1 unstructured-client'
30+
sdk_version: str = '0.15.5'
31+
gen_version: str = '2.237.2'
32+
user_agent: str = 'speakeasy-sdk/python 0.15.5 2.237.2 0.0.1 unstructured-client'
3333
retry_config: RetryConfig = None
3434

3535
def get_server_details(self) -> Tuple[str, Dict[str, str]]:

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def do_request():
7575
if res.status_code == parsed_code:
7676
raise TemporaryError(res)
7777
except requests.exceptions.ConnectionError as exception:
78-
if not retries.config.config.retry_connection_errors:
78+
if retries.config.config.retry_connection_errors:
7979
raise
8080

8181
raise PermanentError(exception) from exception
8282
except requests.exceptions.Timeout as exception:
83-
if not retries.config.config.retry_connection_errors:
83+
if retries.config.config.retry_connection_errors:
8484
raise
8585

8686
raise PermanentError(exception) from exception

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,22 @@ def _parse_security_scheme_value(client: SecurityClient, scheme_metadata: Dict,
110110
else:
111111
raise Exception('not supported')
112112
elif scheme_type == "openIdConnect":
113-
client.client.headers[header_name] = value
113+
client.client.headers[header_name] = _apply_bearer(value)
114114
elif scheme_type == 'oauth2':
115-
client.client.headers[header_name] = value
115+
client.client.headers[header_name] = _apply_bearer(value)
116116
elif scheme_type == 'http':
117117
if sub_type == 'bearer':
118-
client.client.headers[header_name] = value.lower().startswith(
119-
'bearer ') and value or f'Bearer {value}'
118+
client.client.headers[header_name] = _apply_bearer(value)
120119
else:
121120
raise Exception('not supported')
122121
else:
123122
raise Exception('not supported')
124123

125124

125+
def _apply_bearer(token: str) -> str:
126+
return token.lower().startswith('bearer ') and token or f'Bearer {token}'
127+
128+
126129
def _parse_basic_auth_scheme(client: SecurityClient, scheme: dataclass):
127130
username = ""
128131
password = ""

0 commit comments

Comments
 (0)