core.bones.uri

Module Contents

Classes

UriBone

The UriBone is used for storing URI and URL.

Attributes

PORT_MIN

PORT_MAX

core.bones.uri.PORT_MIN: Final[int] = 1
core.bones.uri.PORT_MAX: Final[int]
class core.bones.uri.UriBone(*, accepted_protocols=None, accepted_ports=None, clean_get_params=False, domain_allowed_list=None, domain_disallowed_list=None, local_path_allowed=False, **kwargs)

Bases: core.bones.BaseBone

The UriBone is used for storing URI and URL.

Parameters:
  • accepted_protocols (str | Iterable[str] | None) – The accepted protocols can be set to allow only the provide protocols.

  • accepted_ports (int | str | Iterable[int] | Iterable[str] | None) –

  • clean_get_params (bool) –

  • domain_allowed_list (Iterable[str] | None) –

  • domain_disallowed_list (Iterable[str] | None) –

  • local_path_allowed (bool) –

:param accepted_ports The accepted ports can be set to allow only the provide ports. .. code-block:: python

# Example UriBone(accepted_ports=1) UriBone(accepted_ports=”2”) UriBone(accepted_ports=”1-4”) UriBone(accepted_ports=(1,”2”,”4-10”))

Parameters:
  • clean_get_params (bool) – When set to True, the GET-parameter for the URL will be cleaned.

  • domain_allowed_list (Iterable[str] | None) – If set, only the URLs that are matched with an entry of this iterable will be accepted.

  • domain_disallowed_list (Iterable[str] | None) – If set, only the URLs that are not matched with an entry of this iterable will be accepted.

  • local_path_allowed (bool) – If True, the URLs that are local paths will be prefixed with “/”.

  • accepted_protocols (str | Iterable[str] | None) –

  • accepted_ports (int | str | Iterable[int] | Iterable[str] | None) –

type = 'uri'
classmethod _build_accepted_ports(accepted_ports)
Parameters:

accepted_ports (str | int | Iterable[str | int]) –

Return type:

list[range]

isInvalid(value)
Return type:

str | None

singleValueFromClient(value, skel, bone_name, client_data)
Return type:

tuple

structure()
Return type:

dict