Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env.local
**/__pycache__/
**/.speakeasy/temp/
**/.speakeasy/logs/
Expand Down
21 changes: 13 additions & 8 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: 8038a5b9e376d44bad2fd4c117922954
docVersion: 1.1.45
speakeasyVersion: 1.601.0
generationVersion: 2.680.0
releaseVersion: 0.42.3
configChecksum: 3d02dd7ca437781b3d721fab5d7b9adc
docChecksum: adbc2b975ff4cc2c5578a5dd0d51e152
docVersion: 1.1.47
speakeasyVersion: 1.615.2
generationVersion: 2.698.4
releaseVersion: 0.43.0
configChecksum: aa508e741e22e8bcf191aa310680d956
repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git
repoSubDirectory: .
installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git
Expand All @@ -16,13 +16,13 @@ features:
acceptHeaders: 3.0.0
additionalDependencies: 1.0.0
constsAndDefaults: 1.0.5
core: 5.19.8
core: 5.20.4
customCodeRegions: 0.1.1
defaultEnabledRetries: 0.2.0
enumUnions: 0.1.0
envVarSecurityUsage: 0.3.2
examples: 3.0.2
globalSecurity: 3.0.3
globalSecurity: 3.0.4
globalSecurityCallbacks: 1.0.0
globalSecurityFlattening: 1.0.0
globalServerURLs: 3.1.1
Expand Down Expand Up @@ -101,6 +101,8 @@ generatedFiles:
- docs/models/shared/astradbconnectorconfiginput.md
- docs/models/shared/azureaisearchconnectorconfig.md
- docs/models/shared/azureaisearchconnectorconfiginput.md
- docs/models/shared/azuredestinationconnectorconfig.md
- docs/models/shared/azuredestinationconnectorconfiginput.md
- docs/models/shared/azuresourceconnectorconfig.md
- docs/models/shared/azuresourceconnectorconfiginput.md
- docs/models/shared/bodyrunworkflow.md
Expand Down Expand Up @@ -287,6 +289,8 @@ generatedFiles:
- src/unstructured_client/models/shared/astradbconnectorconfiginput.py
- src/unstructured_client/models/shared/azureaisearchconnectorconfig.py
- src/unstructured_client/models/shared/azureaisearchconnectorconfiginput.py
- src/unstructured_client/models/shared/azuredestinationconnectorconfig.py
- src/unstructured_client/models/shared/azuredestinationconnectorconfiginput.py
- src/unstructured_client/models/shared/azuresourceconnectorconfig.py
- src/unstructured_client/models/shared/azuresourceconnectorconfiginput.py
- src/unstructured_client/models/shared/body_run_workflow.py
Expand Down Expand Up @@ -712,3 +716,4 @@ examples:
application/json: {"detail": []}
examplesVersion: 1.0.2
generatedTests: {}
releaseNotes: "## Python SDK Changes Detected:\n* `unstructured_client.destinations.create_destination()`: \n * `request.create_destination_connector.config.[azure_destination_connector_config_input]` **Added**\n * `response.config.[azure_destination_connector_config]` **Added**\n* `unstructured_client.destinations.get_destination()`: `response.config.[azure_destination_connector_config]` **Added**\n* `unstructured_client.destinations.list_destinations()`: \n * `request.destination_type` **Changed**\n * `response.[].config.[azure_destination_connector_config]` **Added**\n* `unstructured_client.destinations.update_destination()`: \n * `request.update_destination_connector.config.[azure_destination_connector_config_input]` **Added**\n * `response.config.[azure_destination_connector_config]` **Added**\n"
16 changes: 8 additions & 8 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
speakeasyVersion: 1.601.0
speakeasyVersion: 1.615.2
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:8165f715321cd34bcebb6c9bb0734a1791777229937787b8e13707d519b05a5e
sourceBlobDigest: sha256:b4f8d9a6b0f4245c50b5e53298343df470978417248fa3988aeeb84ec9200c93
sourceRevisionDigest: sha256:fa851bba6d6e224f6b8fd9e3f098ae1079b29ded25ce17ab72518540e9ee3902
sourceBlobDigest: sha256:52c18b3b411c76e4f8dc5d2b852e3630d6401b3a8022e292a432c2ebe8d2c2b6
tags:
- latest
- speakeasy-sdk-regen-1754698272
- 1.1.45
- speakeasy-sdk-regen-1756339855
- 1.1.47
targets:
unstructured-python:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:8165f715321cd34bcebb6c9bb0734a1791777229937787b8e13707d519b05a5e
sourceBlobDigest: sha256:b4f8d9a6b0f4245c50b5e53298343df470978417248fa3988aeeb84ec9200c93
sourceRevisionDigest: sha256:fa851bba6d6e224f6b8fd9e3f098ae1079b29ded25ce17ab72518540e9ee3902
sourceBlobDigest: sha256:52c18b3b411c76e4f8dc5d2b852e3630d6401b3a8022e292a432c2ebe8d2c2b6
codeSamplesNamespace: my-source-code-samples
codeSamplesRevisionDigest: sha256:a5e11972bfb15e43b7fcb2647b3a7b3e129e9303294f9110670280971b10780a
codeSamplesRevisionDigest: sha256:54f08520c48e4b706c8ffa67fd8c59940bad24add35b7159dea7f73042ff0e44
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1119,4 +1119,14 @@ Based on:
### Generated
- [python v0.42.3] .
### Releases
- [PyPI v0.42.3] https://pypi.org/project/unstructured-client/0.42.3 - .
- [PyPI v0.42.3] https://pypi.org/project/unstructured-client/0.42.3 - .

## 2025-09-15 00:10:40
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.615.2 (2.698.4) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.43.0] .
### Releases
- [PyPI v0.43.0] https://pypi.org/project/unstructured-client/0.43.0 - .
4 changes: 2 additions & 2 deletions codeSamples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ actions:
"x-codeSamples":
- "lang": "python"
"label": "create_destination"
"source": "from unstructured_client import UnstructuredClient\nfrom unstructured_client.models import shared\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.create_destination(request={\n \"create_destination_connector\": {\n \"name\": \"<value>\",\n \"type\": shared.DestinationConnectorType.MOTHERDUCK,\n \"config\": {\n \"index_name\": \"<value>\",\n \"api_key\": \"<value>\",\n \"namespace\": \"<value>\",\n \"batch_size\": 50,\n },\n },\n })\n\n assert res.destination_connector_information is not None\n\n # Handle response\n print(res.destination_connector_information)"
"source": "from unstructured_client import UnstructuredClient\nfrom unstructured_client.models import shared\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.create_destination(request={\n \"create_destination_connector\": {\n \"name\": \"<value>\",\n \"type\": shared.DestinationConnectorType.MONGODB,\n \"config\": {\n \"index_name\": \"<value>\",\n \"api_key\": \"<value>\",\n \"namespace\": \"<value>\",\n \"batch_size\": 50,\n },\n },\n })\n\n assert res.destination_connector_information is not None\n\n # Handle response\n print(res.destination_connector_information)"
- target: $["paths"]["/api/v1/destinations/{destination_id}"]["delete"]
update:
"x-codeSamples":
Expand All @@ -32,7 +32,7 @@ actions:
"x-codeSamples":
- "lang": "python"
"label": "update_destination"
"source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.update_destination(request={\n \"destination_id\": \"9726962d-9d1e-4f84-8787-c7313d183927\",\n \"update_destination_connector\": {\n \"config\": {\n \"bootstrap_servers\": \"<value>\",\n \"port\": 9092,\n \"topic\": \"<value>\",\n \"kafka_api_key\": \"<value>\",\n \"secret\": \"<value>\",\n \"batch_size\": 100,\n },\n },\n })\n\n assert res.destination_connector_information is not None\n\n # Handle response\n print(res.destination_connector_information)"
"source": "from unstructured_client import UnstructuredClient\n\n\nwith UnstructuredClient() as uc_client:\n\n res = uc_client.destinations.update_destination(request={\n \"destination_id\": \"962d9d1e-f847-487c-a731-3d18392716fb\",\n \"update_destination_connector\": {\n \"config\": {\n \"remote_url\": \"https://lined-clamp.info\",\n \"service_account_key\": \"<value>\",\n },\n },\n })\n\n assert res.destination_connector_information is not None\n\n # Handle response\n print(res.destination_connector_information)"
- target: $["paths"]["/api/v1/destinations/{destination_id}/connection-check"]["get"]
update:
"x-codeSamples":
Expand Down
6 changes: 6 additions & 0 deletions docs/models/shared/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

## Supported Types

### `shared.AzureDestinationConnectorConfigInput`

```python
value: shared.AzureDestinationConnectorConfigInput = /* values here */
```

### `shared.AstraDBConnectorConfigInput`

```python
Expand Down
6 changes: 6 additions & 0 deletions docs/models/shared/destinationconnectorinformationconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

## Supported Types

### `shared.AzureDestinationConnectorConfig`

```python
value: shared.AzureDestinationConnectorConfig = /* values here */
```

### `shared.AstraDBConnectorConfig`

```python
Expand Down
1 change: 1 addition & 0 deletions docs/models/shared/destinationconnectortype.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

| Name | Value |
| -------------------------------- | -------------------------------- |
| `AZURE` | azure |
| `ASTRADB` | astradb |
| `AZURE_AI_SEARCH` | azure_ai_search |
| `COUCHBASE` | couchbase |
Expand Down
6 changes: 6 additions & 0 deletions docs/models/shared/updatedestinationconnectorconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

## Supported Types

### `shared.AzureDestinationConnectorConfigInput`

```python
value: shared.AzureDestinationConnectorConfigInput = /* values here */
```

### `shared.AstraDBConnectorConfigInput`

```python
Expand Down
7 changes: 6 additions & 1 deletion gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
oAuth2PasswordEnabled: false
hoistGlobalSecurity: true
tests:
generateTests: true
generateNewTests: false
skipResponseBodyAssertions: false
python:
version: 0.42.3
version: 0.43.0
additionalDependencies:
dev:
deepdiff: '>=6.0'
Expand All @@ -36,6 +37,9 @@ python:
httpx: '>=0.27.0'
pypdf: '>=4.0'
requests-toolbelt: '>=1.0.0'
allowedRedefinedBuiltins:
- id
- object
authors:
- Unstructured
baseErrorName: UnstructuredClientError
Expand Down Expand Up @@ -69,4 +73,5 @@ python:
pytestFilterWarnings: []
pytestTimeout: 0
responseFormat: envelope
sseFlatResponse: false
templateVersion: v2
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[project]
name = "unstructured-client"
version = "0.42.3"
version = "0.43.0"
description = "Python Client SDK for Unstructured API"
authors = [{ name = "Unstructured" },]
readme = "README-PYPI.md"
Expand Down Expand Up @@ -49,6 +49,7 @@ build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"
pythonpath = ["src"]

[tool.mypy]
Expand Down
5 changes: 5 additions & 0 deletions scripts/prepare_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
GITHUB_URL = (
GITHUB_URL[: -len(".git")] if GITHUB_URL.endswith(".git") else GITHUB_URL
)
REPO_SUBDIR = "."
# Ensure the subdirectory has a trailing slash
if not REPO_SUBDIR.endswith("/"):
REPO_SUBDIR += "/"
# links on PyPI should have absolute URLs
readme_contents = re.sub(
r"(\[[^\]]+\]\()((?!https?:)[^\)]+)(\))",
lambda m: m.group(1)
+ GITHUB_URL
+ "/blob/master/"
+ REPO_SUBDIR
+ m.group(2)
+ m.group(3),
readme_contents,
Expand Down
8 changes: 4 additions & 4 deletions src/unstructured_client/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import importlib.metadata

__title__: str = "unstructured-client"
__version__: str = "0.42.3"
__openapi_doc_version__: str = "1.1.45"
__gen_version__: str = "2.680.0"
__user_agent__: str = "speakeasy-sdk/python 0.42.3 2.680.0 1.1.45 unstructured-client"
__version__: str = "0.43.0"
__openapi_doc_version__: str = "1.1.47"
__gen_version__: str = "2.698.4"
__user_agent__: str = "speakeasy-sdk/python 0.43.0 2.698.4 1.1.47 unstructured-client"

try:
if __package__ is not None:
Expand Down
12 changes: 11 additions & 1 deletion src/unstructured_client/basesdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@

class BaseSDK:
sdk_configuration: SDKConfiguration
parent_ref: Optional[object] = None
"""
Reference to the root SDK instance, if any. This will prevent it from
being garbage collected while there are active streams.
"""

def __init__(self, sdk_config: SDKConfiguration) -> None:
def __init__(
self,
sdk_config: SDKConfiguration,
parent_ref: Optional[object] = None,
) -> None:
self.sdk_configuration = sdk_config
self.parent_ref = parent_ref

def _get_url(self, base_url, url_variables):
sdk_url, sdk_variables = self.sdk_configuration.get_server_details()
Expand Down
18 changes: 15 additions & 3 deletions src/unstructured_client/models/errors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from .unstructuredclienterror import UnstructuredClientError
from typing import TYPE_CHECKING
from importlib import import_module
import builtins
import sys

if TYPE_CHECKING:
from .httpvalidationerror import (
Expand All @@ -14,7 +16,6 @@
from .responsevalidationerror import ResponseValidationError
from .sdkerror import SDKError
from .servererror import ServerError, ServerErrorData
from .unstructuredclienterror import UnstructuredClientError

__all__ = [
"Detail",
Expand All @@ -37,10 +38,21 @@
"SDKError": ".sdkerror",
"ServerError": ".servererror",
"ServerErrorData": ".servererror",
"UnstructuredClientError": ".unstructuredclienterror",
}


def dynamic_import(modname, retries=3):
for attempt in range(retries):
try:
return import_module(modname, __package__)
except KeyError:
# Clear any half-initialized module and retry
sys.modules.pop(modname, None)
if attempt == retries - 1:
break
raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")


def __getattr__(attr_name: str) -> object:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
Expand All @@ -49,7 +61,7 @@ def __getattr__(attr_name: str) -> object:
)

try:
module = import_module(module_name, __package__)
module = dynamic_import(module_name)
result = getattr(module, attr_name)
return result
except ImportError as e:
Expand Down
6 changes: 4 additions & 2 deletions src/unstructured_client/models/errors/httpvalidationerror.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from dataclasses import dataclass, field
import httpx
from typing import List, Optional, Union
from typing_extensions import TypeAliasType
Expand All @@ -23,8 +24,9 @@ class HTTPValidationErrorData(BaseModel):
detail: Optional[Detail] = None


@dataclass(frozen=True)
class HTTPValidationError(UnstructuredClientError):
data: HTTPValidationErrorData
data: HTTPValidationErrorData = field(hash=False)

def __init__(
self,
Expand All @@ -34,4 +36,4 @@ def __init__(
):
message = body or raw_response.text
super().__init__(message, raw_response, body)
self.data = data
object.__setattr__(self, "data", data)
6 changes: 5 additions & 1 deletion src/unstructured_client/models/errors/no_response_error.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from dataclasses import dataclass


@dataclass(frozen=True)
class NoResponseError(Exception):
"""Error raised when no HTTP response is received from the server."""

message: str

def __init__(self, message: str = "No response received"):
self.message = message
object.__setattr__(self, "message", message)
super().__init__(message)

def __str__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import httpx
from typing import Optional
from dataclasses import dataclass

from unstructured_client.models.errors import UnstructuredClientError


@dataclass(frozen=True)
class ResponseValidationError(UnstructuredClientError):
"""Error raised when there is a type mismatch between the response data and the expected Pydantic model."""

Expand Down
2 changes: 2 additions & 0 deletions src/unstructured_client/models/errors/sdkerror.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import httpx
from typing import Optional
from dataclasses import dataclass

from unstructured_client.models.errors import UnstructuredClientError

MAX_MESSAGE_LEN = 10_000


@dataclass(frozen=True)
class SDKError(UnstructuredClientError):
"""The fallback error class if no more specific error class is matched."""

Expand Down
Loading