Skip to content

NEXUS-909 feat Enable custom server URLs in the workflow endpoints #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 22, 2025
Merged
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
5 changes: 1 addition & 4 deletions .genignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# https://www.speakeasyapi.dev/docs/customize-sdks/monkey-patching
# https://www.speakeasy.com/docs/customize/code/monkey-patching

# ignore human-written files and directories
src/unstructured_client/_unstructured
_jupyter
_sample_docs
_test_unstructured_client

# ignore Makefile
Makefile

# Ignore the general.partition code until we can fix the base_url issue
src/unstructured_client/general.py
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.speakeasy/temp/
.speakeasy/reports
.venv/
README-PYPI.md
Expand All @@ -11,10 +12,8 @@ __pycache__/
# human-added igore files
.ipynb_checkpoints/
.idea/

.local
*.ipynb

openapi.json
openapi_client.json
openapi_serverless.json
Expand Down
18 changes: 10 additions & 8 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: 6433f28e5b70c3c0d7754fc7a88db327
docVersion: 1.1.7
speakeasyVersion: 1.535.1
generationVersion: 2.585.2
releaseVersion: 0.33.1
configChecksum: 8b5e7fbd95d040ba09964f3c97c3156a
speakeasyVersion: 1.537.0
generationVersion: 2.588.0
releaseVersion: 0.34.0
configChecksum: 0ba814fcbe0d0489903de407d36313af
repoURL: https://github.com/Unstructured-IO/unstructured-python-client.git
repoSubDirectory: .
installationURL: https://github.com/Unstructured-IO/unstructured-python-client.git
Expand All @@ -16,7 +16,7 @@ features:
acceptHeaders: 3.0.0
additionalDependencies: 1.0.0
constsAndDefaults: 1.0.5
core: 5.14.0
core: 5.15.0
defaultEnabledRetries: 0.2.0
enumUnions: 0.1.0
envVarSecurityUsage: 0.3.2
Expand Down Expand Up @@ -228,6 +228,7 @@ generatedFiles:
- src/unstructured_client/_version.py
- src/unstructured_client/basesdk.py
- src/unstructured_client/destinations.py
- src/unstructured_client/general.py
- src/unstructured_client/httpclient.py
- src/unstructured_client/jobs.py
- src/unstructured_client/models/__init__.py
Expand Down Expand Up @@ -369,6 +370,7 @@ generatedFiles:
- src/unstructured_client/types/basemodel.py
- src/unstructured_client/utils/__init__.py
- src/unstructured_client/utils/annotations.py
- src/unstructured_client/utils/datetimes.py
- src/unstructured_client/utils/enums.py
- src/unstructured_client/utils/eventstreaming.py
- src/unstructured_client/utils/forms.py
Expand Down Expand Up @@ -668,7 +670,7 @@ examples:
"200":
application/json: {"created_at": "2025-03-13T23:31:02.383Z", "id": "c3274f55-9861-4e4e-8526-4273aa4d2772", "status": "FAILURE"}
"422":
application/json: {"detail": [{"loc": ["<value>"], "msg": "<value>", "type": "<value>"}, {"loc": [], "msg": "<value>", "type": "<value>"}, {"loc": [], "msg": "<value>", "type": "<value>"}]}
application/json: {"detail": "<value>"}
create_connection_check_sources:
speakeasy-default-create-connection-check-sources:
parameters:
Expand All @@ -679,7 +681,7 @@ examples:
"202":
application/json: {"created_at": "2023-03-12T05:54:05.025Z", "id": "b5793adb-057f-470c-ae7e-309d786a99eb", "status": "SUCCESS"}
"422":
application/json: {"detail": []}
application/json: {"detail": "<value>"}
get_connection_check_sources:
speakeasy-default-get-connection-check-sources:
parameters:
Expand All @@ -690,6 +692,6 @@ examples:
"200":
application/json: {"created_at": "2023-09-12T00:38:55.692Z", "id": "f7d1d931-a753-4fe9-ae3f-671f188a9b55", "status": "SUCCESS"}
"422":
application/json: {"detail": [{"loc": ["<value>"], "msg": "<value>", "type": "<value>"}, {"loc": [], "msg": "<value>", "type": "<value>"}]}
application/json: {"detail": "<value>"}
examplesVersion: 1.0.1
generatedTests: {}
10 changes: 5 additions & 5 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
speakeasyVersion: 1.535.1
speakeasyVersion: 1.537.0
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:6771a944eaf5581cde4835c43e7997635f7d80ce441763c47cad9c305ba4a91e
sourceRevisionDigest: sha256:f5fa536ffbf6240b18b267193074d11564a899dd6fdee36261205b93c8f84880
sourceBlobDigest: sha256:521a1c7be485e2be9f33ff7b82566823e96827cb69f7ca7775e0dd3dcc52d825
tags:
- latest
- speakeasy-sdk-regen-1745261613
- speakeasy-sdk-regen-1745334275
- 1.1.7
targets:
unstructured-python:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:6771a944eaf5581cde4835c43e7997635f7d80ce441763c47cad9c305ba4a91e
sourceRevisionDigest: sha256:f5fa536ffbf6240b18b267193074d11564a899dd6fdee36261205b93c8f84880
sourceBlobDigest: sha256:521a1c7be485e2be9f33ff7b82566823e96827cb69f7ca7775e0dd3dcc52d825
codeSamplesNamespace: my-source-code-samples
codeSamplesRevisionDigest: sha256:06bd35ef844f603c2c2357092fc875febff06f5c9eb855e262ff013b8935d8d6
codeSamplesRevisionDigest: sha256:5940dadc286e702b4e23f58d1b7b536ffea4648a9f4f4a7ab650c6c107730a28
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 @@ -977,4 +977,14 @@ Based on:
### Generated
- [python v0.33.1] .
### Releases
- [PyPI v0.33.1] https://pypi.org/project/unstructured-client/0.33.1 - .
- [PyPI v0.33.1] https://pypi.org/project/unstructured-client/0.33.1 - .

## 2025-04-22 15:11:11
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.537.0 (2.588.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v0.34.0] .
### Releases
- [PyPI v0.34.0] https://pypi.org/project/unstructured-client/0.34.0 - .
19 changes: 8 additions & 11 deletions _test_unstructured_client/unit/test_custom_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def mock_post(request):
with pytest.raises(Exception):
session.general.partition(request=req, retries=retries)

pattern = re.compile(f"Failed to process a request due to connection error .*? "
pattern = re.compile("Failed to process a request due to connection error .*? "
"Attempting retry number 1 after sleep.")
assert bool(pattern.search(caplog.text))

Expand Down Expand Up @@ -198,23 +198,20 @@ def test_unit_clean_server_url_fixes_malformed_paid_api_url(server_url: str):


@pytest.mark.parametrize(
"server_url",
"server_url,expected_url",
[
# -- well-formed url --
"http://localhost:8000",
# -- common malformed urls --
"localhost:8000",
"localhost:8000/general/v0/general",
"http://localhost:8000/general/v0/general",
("http://localhost:8000", "http://localhost:8000"),
("localhost:8000", "http://localhost:8000"),
("localhost:8000/general/v0/general", "http://localhost:8000/general/v0/general"),
("http://localhost:8000/general/v0/general", "http://localhost:8000/general/v0/general"),
],
)
def test_unit_clean_server_url_fixes_malformed_localhost_url(server_url: str):
def test_unit_clean_server_url_fixes_non_unst_domain_url(server_url: str, expected_url: str):
client = UnstructuredClient(
server_url=server_url,
api_key_auth=FAKE_KEY,
)
assert client.general.sdk_configuration.server_url == "http://localhost:8000"

assert client.general.sdk_configuration.server_url == expected_url

@pytest.mark.parametrize(
"server_url",
Expand Down
1 change: 0 additions & 1 deletion _test_unstructured_client/unit/test_request_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
get_base_url,
get_multipart_stream_fields,
)
from unstructured_client.models import shared


# make the above test using @pytest.mark.parametrize
Expand Down
Loading
Loading