f5sdk.utils.http_utils module¶
Python module containing helper http utility functions
-
f5sdk.utils.http_utils.
download_to_file
(url, file_name)¶ Downloads an artifact to a local file
Notes
Uses a stream to avoid loading into memory
- Parameters
url (str) – the URL where the artifact should be downloaded from
file_name (str) – the local file name where the artifact should be downloaded
- Returns
- Return type
None
-
f5sdk.utils.http_utils.
make_request
(host, uri, **kwargs)¶ Makes request to device (HTTP/S)
- Parameters
uri (str) – the URI where the request should be made
**kwargs – optional keyword arguments
- Keyword Arguments
port (int) – the port to use
method (str) – the HTTP method to use
query_parameters (dict) – the HTTP query parameters to use
headers (str) – the HTTP headers to use (may override defaults)
body (str) – the HTTP body to use
body_content_type (str) – the HTTP body content type to use
bool_response (bool) – return boolean based on HTTP success/failure
basic_auth (dict) – use basic auth: {‘user’: ‘foo’, ‘password’: ‘bar’}
advanced_return (bool) – return additional information, like HTTP status code to caller
- Returns
a dictionary containing the JSON response
- Return type
dict
-
f5sdk.utils.http_utils.
parse_url
(url)¶ Parse URL
- Parameters
url (str) – the URL that should be parsed
- Returns
object containing the parsed URL contents
{ 'protocol': 'https', 'host': 'test.local', 'path': '/foo/bar', 'query': '' }
- Return type
dict