22
33import argparse
44import json
5- from urllib .parse import quote , unquote , urlsplit , urlunsplit
5+ import urllib .parse
66
77from fal .api .client import SyncServerlessClient
88
@@ -157,7 +157,7 @@ def _apps_command_hint(
157157
158158def _deployed_app_playground_url (url : str ) -> str | None :
159159 """Map a server-provided model URL to its owning app's Playground tab."""
160- parsed = urlsplit (url )
160+ parsed = urllib . parse . urlsplit (url )
161161 path_segments = parsed .path .split ("/" )
162162 if (
163163 parsed .scheme not in {"http" , "https" }
@@ -172,18 +172,19 @@ def _deployed_app_playground_url(url: str) -> str | None:
172172 if len (endpoint_segments ) < 2 or any (not segment for segment in endpoint_segments ):
173173 return url
174174
175- decoded_segments = [unquote (segment ) for segment in endpoint_segments ]
175+ decoded_segments = [urllib . parse . unquote (segment ) for segment in endpoint_segments ]
176176 if decoded_segments [- 1 ] in _UNTESTABLE_PLAYGROUND_SUFFIXES :
177177 return None
178178
179179 owner , app_name = decoded_segments [:2 ]
180180 formatted_endpoint = "/" .join (decoded_segments )
181181 path = (
182- f"/dashboard/apps/{ quote (owner , safe = '' )} /{ quote (app_name , safe = '' )} "
182+ f"/dashboard/apps/{ urllib .parse .quote (owner , safe = '' )} "
183+ f"/{ urllib .parse .quote (app_name , safe = '' )} "
183184 "/testing/playground"
184185 )
185- query = f"endpoint={ quote (formatted_endpoint , safe = '' )} "
186- return urlunsplit ((parsed .scheme , parsed .netloc , path , query , "" ))
186+ query = f"endpoint={ urllib . parse . quote (formatted_endpoint , safe = '' )} "
187+ return urllib . parse . urlunsplit ((parsed .scheme , parsed .netloc , path , query , "" ))
187188
188189
189190def _render_deploy_result (
0 commit comments