starting to abuse classes less

This commit is contained in:
Matthew Connelly 2019-05-21 18:09:05 +01:00
parent 87a1fdce4f
commit 740bb07a64
1 changed files with 6 additions and 2 deletions

View File

@ -251,7 +251,6 @@ class Py3CX:
self.uname=getenv(ENV_AUTH_USER, None)
self.passw=getenv(ENV_AUTH_PASS, None)
self.rq=Request(uri=self.uri, verify=tls_verify)
def authenticate(self, username=None, password=None):
if username is not None and password is not None:
self.uname=username
@ -261,7 +260,6 @@ class Py3CX:
'Username': self.uname,
'Password': self.passw})
self.rq.sess.headers.update({'x-xsrf-token':rs.cookies['XSRF-TOKEN']})
@property
def authenticated(self):
try:
@ -269,4 +267,10 @@ class Py3CX:
except APIError:
return False
return True
@property
def System(self):
assert self.authenticated, "Py3CX not authenticated yet!"
if self.tcxsystem is None:
self.tcxsystem=PhoneSystem(self)
return self.tcxsystem