Utils
rest_format
Code
- bigrest.utils.utils.rest_format(text: str) str
Converts a string to be compatible with iControl REST API.
- Parameters:
text – String to be converted.
Example
path = (
f"/mgmt/tm/ltm/pool/{rest_format('/bigrest/bigrest_pool')}"
f"/members/{rest_format('/bigrest/172.17.0.1%1:80')}"
)
device.delete(path)
Explanation
token
Code
- bigrest.utils.utils.token(device: str, username: str, password: str, login_provider: str = 'tmos', debug: str = None, verify: bool = True, timeout: int = 10) str
Gets a token from the device.
- Parameters:
device – Name or IP of the device to send the REST requests.
username – Username used to login to the device.
password – Password used to login to the device.
login_provider – Login provider used to authenticate the user.
debug – Debug file name to be used to output the debug information.
verify – Disables SSL certificate validation if set to False
timeout – Specifies the number of seconds to wait when sending requests to the device.
- Exceptions:
InvalidOptionError: Raised when invalid options are used as arguments.
Example
token_ = token("192.168.255.1", "admin", "password")
Explanation
refresh_token
Code
- bigrest.utils.utils.refresh_token(device: str, username: str, password: str, login_provider: str = 'tmos', debug: str = None, verify: bool = True, timeout: int = 10) str
Gets a refresh token from the device.
- Parameters:
device – Name or IP of the device to send the REST requests.
username – Username used to login to the device.
password – Password used to login to the device.
login_provider – Login provider used to authenticate the user.
debug – Debug file name to be used to output the debug information.
verify – Disables SSL certificate validation if set to False
timeout – Specifies the number of seconds to wait when sending requests to the device.
- Exceptions:
InvalidOptionError: Raised when invalid options are used as arguments.
Example
refresh_token_ = refresh_token("192.168.255.1", "admin", "password")