thorn.validators — Thorn 1.3.0 documentation

# thorn.validators

`thorn.validators.` `ensure_protocol`(*allowed)

  Only allow recipient URLs using specific protocols.

  Example:
    ensure_protocol(‘https’, ‘http://‘)

`thorn.validators.` `ensure_port`(*allowed)

`thorn.validators.` `block_internal_ips`()

  Block recipient URLs that have an internal IP address.

  Warning

  This does not check for private networks, it will only make sure the IP address is not in a reserved private block (e.g. 192.168.0.1/24).

`thorn.validators.` `block_cidr_network`(*blocked_networks)

  Block recipient URLs from a list of CIDR networks.

  Example:

  > block_cidr_network(‘192.168.0.0/24’, ‘132.34.23.0/24’)