Skip to content

Commit df9ebc9

Browse files
committed
We need to strip the path properly in general.py
1 parent 6edea62 commit df9ebc9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/unstructured_client/general.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from unstructured_client._hooks import HookContext
88
from unstructured_client.models import errors, operations, shared
99
from unstructured_client.types import BaseModel, OptionalNullable, UNSET
10+
from unstructured_client._hooks.custom.clean_server_url_hook import clean_server_url
1011

1112

1213
class PartitionAcceptEnum(str, Enum):
@@ -51,7 +52,8 @@ def partition(
5152
# Note(austin): Add a custom check to handle the default server URL
5253
# The SDK globally defaults to the platform URL.
5354
# If that hasn't changed, we need to switch to the partition url here.
54-
if "https://platform.unstructuredapp.io" in base_url:
55+
base_url = clean_server_url(base_url)
56+
if base_url == "https://platform.unstructuredapp.io":
5557
base_url = "https://api.unstructuredapp.io"
5658

5759
if not isinstance(request, BaseModel):
@@ -184,7 +186,8 @@ async def partition_async(
184186
# Note(austin): Add a custom check to handle the default server URL
185187
# The SDK globally defaults to the platform URL.
186188
# If that hasn't changed, we need to switch to the partition url here.
187-
if "https://platform.unstructuredapp.io" in base_url:
189+
base_url = clean_server_url(base_url)
190+
if base_url == "https://platform.unstructuredapp.io":
188191
base_url = "https://api.unstructuredapp.io"
189192

190193
if not isinstance(request, BaseModel):

0 commit comments

Comments
 (0)