prefect.utilities
urls
prefect.utilities.urls
Functions
validate_restricted_url
Validate that the provided URL is safe for outbound requests. This prevents attacks like SSRF (Server Side Request Forgery), where an attacker can make requests to internal services (like the GCP metadata service, localhost addresses, or in-cluster Kubernetes services)
Args:
url
: The URL to validate.
Raises:
ValueError
: If the URL is a restricted URL.
convert_class_to_name
Convert CamelCase class name to dash-separated lowercase name
url_for
Returns the URL for a Prefect object.
Pass in a supported object directly or provide an object name and ID.
Args:
obj
: A Prefect object to get the URL for, or its URL name and ID.obj_id
: The UUID of the object.url_type
: Whether to return the URL for the UI (default) or API.default_base_url
: The default base URL to use if no URL is configured.additional_format_kwargs
: Additional keyword arguments to pass to the URL format.
Returns:
- Optional[str]: The URL for the given object or None if the object is not supported.
Examples:
url_for(my_flow_run) url_for(obj=my_flow_run) url_for(“flow-run”, obj_id=“123e4567-e89b-12d3-a456-426614174000”)