MCPcopy Create free account
hub / github.com/BerriAI/litellm / append_query_params

Function append_query_params

litellm/proxy/proxy_cli.py:175–190  ·  view source on GitHub ↗
(url: str | None, params: dict)

Source from the content-addressed store, hash-verified

173
174
175def append_query_params(url: str | None, params: dict) -> str:
176 from litellm._logging import verbose_proxy_logger
177
178 verbose_proxy_logger.debug("url: %s", url)
179 verbose_proxy_logger.debug("params: %s", params)
180 if not isinstance(url, str) or url == "":
181 # Preserve previous startup behavior when DATABASE_URL is absent.
182 # Returning an empty string avoids urlparse type errors in test/dev flows.
183 verbose_proxy_logger.warning("append_query_params received empty or non-string URL, returning empty string")
184 return ""
185 parsed_url: Final = urlparse.urlparse(url)
186 parsed_query: Final = urlparse.parse_qs(parsed_url.query)
187 parsed_query.update(params)
188 encoded_query: Final = urlparse.urlencode(parsed_query, doseq=True)
189 modified_url: Final = urlparse.urlunparse(parsed_url._replace(query=encoded_query))
190 return modified_url
191
192
193def resolve_v2_migration_resolver(*, use_legacy_flag: bool, env_value: str | None) -> bool:

Callers 11

_amainFunction · 0.90
prisma_clientFunction · 0.90
prisma_clientFunction · 0.90
prisma_clientFunction · 0.90
prisma_clientFunction · 0.90
prisma_clientFunction · 0.90
prisma_clientFunction · 0.90
prisma_clientFunction · 0.90
run_serverFunction · 0.85

Calls 4

_replaceMethod · 0.80
debugMethod · 0.45
warningMethod · 0.45
updateMethod · 0.45

Tested by 10

_amainFunction · 0.72
prisma_clientFunction · 0.72
prisma_clientFunction · 0.72
prisma_clientFunction · 0.72
prisma_clientFunction · 0.72
prisma_clientFunction · 0.72
prisma_clientFunction · 0.72
prisma_clientFunction · 0.72