Skip to content

Commit 704666e

Browse files
committed
no choose
1 parent f971cf9 commit 704666e

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

src/unstructured_client/_hooks/custom/clean_server_url_hook.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,6 @@ def clean_server_url(base_url: str) -> str:
3333

3434

3535

36-
def choose_server_url(endpoint_url: str | None, client_url: str, default_endpoint_url: str) -> str:
37-
"""
38-
Helper function to fix a breaking change in the SDK past 0.30.0.
39-
When we merged the partition and platform specs, the client server_url stopped working,
40-
and users need to pass it in the endpoint function.
41-
For now, call this helper in the generated code to set the correct url.
42-
43-
Order of choices:
44-
Endpoint server_url -> s.general.partition(server_url=...)
45-
(Passed in as None if not set)
46-
47-
Base client server_url -> s = UnstructuredClient(server_url=...)
48-
(Passed as empty string if not set)
49-
50-
Default endpoint URL as defined in the spec
51-
"""
52-
53-
# If the client doesn't get a server_url, it sets a default of platform
54-
# This is not always the correct default - we need to make sure default_endpoint_url is used
55-
# So, only use the client url if it has been set to something else
56-
if client_url == "https://platform.unstructuredapp.io":
57-
client_url = ""
58-
59-
url = endpoint_url if endpoint_url is not None else (client_url or default_endpoint_url)
60-
return clean_server_url(url)
61-
62-
6336
class CleanServerUrlSDKInitHook(SDKInitHook):
6437
"""Hook fixing common mistakes by users in defining `server_url` in the unstructured-client"""
6538

0 commit comments

Comments
 (0)