MCPcopy
hub / github.com/encode/starlette / url_for

Method url_for

starlette/requests.py:198–203  ·  view source on GitHub ↗
(self, name: str, /, **path_params: Any)

Source from the content-addressed store, hash-verified

196 return cast(StateT, self._state)
197
198 def url_for(self, name: str, /, **path_params: Any) -> URL:
199 url_path_provider: Router | Starlette | None = self.scope.get("router") or self.scope.get("app")
200 if url_path_provider is None:
201 raise RuntimeError("The `url_for` method can only be used inside a Starlette application or with a router.")
202 url_path = url_path_provider.url_path_for(name, **path_params)
203 return url_path.make_absolute_url(base_url=self.base_url)
204
205
206async def empty_receive() -> NoReturn:

Callers 8

async_wrapperFunction · 0.45
sync_wrapperFunction · 0.45
appFunction · 0.45
__call__Method · 0.45
http_endpointFunction · 0.45
__call__Method · 0.45
echo_urlsFunction · 0.45
homepageFunction · 0.45

Calls 3

make_absolute_urlMethod · 0.80
getMethod · 0.45
url_path_forMethod · 0.45

Tested by 6

appFunction · 0.36
__call__Method · 0.36
http_endpointFunction · 0.36
__call__Method · 0.36
echo_urlsFunction · 0.36
homepageFunction · 0.36