woob.tools.url

get_url_fragment_param(url: str, name: str, *, default: Union[str, None, NoDefaultType] = NO_DEFAULT) Optional[str][source]

Get a specific fragment parameter from an URL.

Note that this function is only for cases where the fragment is encoded the same way as a query string, e.g. ‘https://example.org/#a=b&c=d’.

Parameters
  • url – The URL to get the fragment parameter from.

  • name – The name of the fragment parameter to get.

  • default – The default value, as a string or None. Should not be set if the function should raise an exception in cases where no value could be obtained using this URL and name.

get_url_fragment_params(url: str) Dict[str, str][source]

Get fragment parameters from an URL.

Note that this function is only for cases where the fragment is encoded the same way as a query string, e.g. ‘https://example.org/#a=b&c=d’.

Parameters

url – The URL to get the parameters from.

get_url_param(url: str, name: str, *, default: Union[str, None, NoDefaultType] = NO_DEFAULT) Optional[str][source]

Get a specific query parameter from an URL.

Parameters
  • url – The URL to get the parameter from.

  • name – The name of the query parameter to get.

  • default – The default value, as a string or None. Should not be set if the function should raise an exception in cases where no value could be obtained using this URL and name.

get_url_params(url: str) Dict[str, str][source]

Get query parameters from an URL.

Parameters

url – The URL to get the parameters from.

get_url_with_params(url: str, **kwargs: Optional[str]) str[source]

Get an URL with additional or without some query parameters.

Parameters

url – The URL to modify.