Url Validation Util
- exception bosdyn.client.url_validation_util.InterfaceNameNotFound(name: str)[source]
Bases:
ExceptionRaised when a specified network interface is not present on the system.
- class bosdyn.client.url_validation_util.BindAdapter(is_robot=True, interface=None, resolved_ip=None, assert_hostname=None, force_host=None, *args, **kwargs)[source]
Bases:
HTTPAdapterAllows binding to a specific network interface and enforcing a custom Host header for HTTP.
- bosdyn.client.url_validation_util.create_bound_session(is_robot=True, interface=None, resolved_ip=None, sni_hostname=None, force_host=None)[source]
Creates a session bound to optional interface with optional SNI hostname.
- bosdyn.client.url_validation_util.validate_url(url)[source]
Checks if any IP address resolved from a URL is in the blacklist. First checks if the hostname is already a valid IP address.
- Parameters:
url – The URL to check.
- Returns:
- A Tuple, where the first value is whether or not the given url was valid.
If True, the second value is a dict containing the url and hostname, if False, the second value is an error statement of what went wrong.
- bosdyn.client.url_validation_util.safe_api_call(method, url, sni_hostname, timeout, is_robot=True, interface=None, **request_data)[source]
Make an API call to a URL, validating the URL and checking for redirects. Will attempt to bind the provided network interface.
- Parameters:
method (str) – method for HTTP request to use
url (str) – URL to make the request to
sni_hostname (str) – Hostname to assert for the Request
timeout (float) – Timeout for the request
interface (str, optional) – Network interface to bind all HTTP calls to, use (“WIFI”, “LTE”, “ETHERNET”). Will override default interface if provided, currently set to WIFI = “wlp5s0”.
- Returns:
A tuple containing the response object (or None) and a status message.
- Return type:
Tuple[Response|None, str]