woob.tools.url

get_url_fragment_param(url, name, *, default=NO_DEFAULT)[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 (str) – The URL to get the fragment parameter from.

  • name (str) – The name of the fragment parameter to get.

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

Return type:

str | None

get_url_fragment_params(url)[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 (str) – The URL to get the parameters from.

Return type:

Dict[str, str]

get_url_param(url, name, *, default=NO_DEFAULT)[source]

Get a specific query parameter from an URL.

Parameters:
  • url (str) – The URL to get the parameter from.

  • name (str) – The name of the query parameter to get.

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

Return type:

str | None

get_url_params(url)[source]

Get query parameters from an URL.

Parameters:

url (str) – The URL to get the parameters from.

Return type:

Dict[str, str]

get_url_with_params(url, **kwargs)[source]

Get an URL with additional or without some query parameters.

Parameters:

url (str) – The URL to modify.

Return type:

str