still cache

This commit is contained in:
Miłosz Stocki 2019-12-12 14:30:04 +01:00
parent 27b2efbc95
commit a83aa9dd3e
Signed by: osiu97
GPG Key ID: E3D1D83FA04F51D6
1 changed files with 4 additions and 2 deletions

View File

@ -39,6 +39,8 @@ class PVEApi(object):
""" """
self.host = host self.host = host
self.url = "https://" + self.host + "/api2/json" self.url = "https://" + self.host + "/api2/json"
self.username = username
self.password = password
if self.check_cacheexpire(): if self.check_cacheexpire():
self.csrftoken = get_auth(self.host, username, password)[0] self.csrftoken = get_auth(self.host, username, password)[0]
self.ticket = get_auth(self.host, username, password)[1] self.ticket = get_auth(self.host, username, password)[1]
@ -59,8 +61,8 @@ class PVEApi(object):
timestamp = data['timestamp'] timestamp = data['timestamp']
return True if time.time() - timestamp > 3600 else False return True if time.time() - timestamp > 3600 else False
except: except:
self.csrftoken = get_auth(self.host, username, password)[0] self.csrftoken = get_auth(self.host, self.username, self.password)[0]
self.ticket = get_auth(self.host, username, password)[1] self.ticket = get_auth(self.host, self.username, self.password)[1]
self.write_ticketcache() self.write_ticketcache()