Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, msg):
super(AuthenticationError, self).__init__(msg)
self.msg = msg
def __init__(self, base_url, username, password, verify_ssl=False):
response_data = requests.post(base_url + "/access/ticket",
verify=verify_ssl,
data={"username": username, "password": password}).json()["data"]
if response_data is None:
raise AuthenticationError("Couldn't authenticate user: {0} to {1}".format(username, base_url + "/access/ticket"))
self.pve_auth_cookie = response_data["ticket"]
self.csrf_prevention_token = response_data["CSRFPreventionToken"]