starting to abuse classes less
This commit is contained in:
parent
87a1fdce4f
commit
740bb07a64
|
@ -251,7 +251,6 @@ class Py3CX:
|
||||||
self.uname=getenv(ENV_AUTH_USER, None)
|
self.uname=getenv(ENV_AUTH_USER, None)
|
||||||
self.passw=getenv(ENV_AUTH_PASS, None)
|
self.passw=getenv(ENV_AUTH_PASS, None)
|
||||||
self.rq=Request(uri=self.uri, verify=tls_verify)
|
self.rq=Request(uri=self.uri, verify=tls_verify)
|
||||||
|
|
||||||
def authenticate(self, username=None, password=None):
|
def authenticate(self, username=None, password=None):
|
||||||
if username is not None and password is not None:
|
if username is not None and password is not None:
|
||||||
self.uname=username
|
self.uname=username
|
||||||
|
@ -261,7 +260,6 @@ class Py3CX:
|
||||||
'Username': self.uname,
|
'Username': self.uname,
|
||||||
'Password': self.passw})
|
'Password': self.passw})
|
||||||
self.rq.sess.headers.update({'x-xsrf-token':rs.cookies['XSRF-TOKEN']})
|
self.rq.sess.headers.update({'x-xsrf-token':rs.cookies['XSRF-TOKEN']})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def authenticated(self):
|
def authenticated(self):
|
||||||
try:
|
try:
|
||||||
|
@ -269,4 +267,10 @@ class Py3CX:
|
||||||
except APIError:
|
except APIError:
|
||||||
return False
|
return False
|
||||||
return True
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue