Skip to content

Commit 3e7784c

Browse files
committed
Just patch general.py and ignore it
1 parent 2f12762 commit 3e7784c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

.genignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,12 @@ _sample_docs
66
_test_unstructured_client
77

88
# ignore Makefile
9-
Makefile
9+
Makefile
10+
11+
# Ignore general.py so we can patch in our partitioning url
12+
# If we ever have a new endpoint under /general, we need to:
13+
# - Comment out this ignore line
14+
# - Generate locally, watch the new endpoint appear
15+
# - Adjust the custom url snippets in the file
16+
# - Bring back the ignore line and commit
17+
src/unstructured_client/general.py

src/unstructured_client/general.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ def partition(
4848
else:
4949
base_url = self._get_url(base_url, url_variables)
5050

51+
# Note(austin): Add a custom check to handle the default server URL
52+
# The SDK globally defaults to the platform URL.
53+
# If that hasn't changed, we need to switch to the partition url here.
54+
if base_url == "https://platform.unstructuredapp.io":
55+
base_url = "https://api.unstructuredapp.io"
56+
5157
if not isinstance(request, BaseModel):
5258
request = utils.unmarshal(request, operations.PartitionRequest)
5359
request = cast(operations.PartitionRequest, request)
@@ -175,6 +181,12 @@ async def partition_async(
175181
else:
176182
base_url = self._get_url(base_url, url_variables)
177183

184+
# Note(austin): Add a custom check to handle the default server URL
185+
# The SDK globally defaults to the platform URL.
186+
# If that hasn't changed, we need to switch to the partition url here.
187+
if base_url == "https://platform.unstructuredapp.io":
188+
base_url = "https://api.unstructuredapp.io"
189+
178190
if not isinstance(request, BaseModel):
179191
request = utils.unmarshal(request, operations.PartitionRequest)
180192
request = cast(operations.PartitionRequest, request)

0 commit comments

Comments
 (0)