allow session() to request a subtree of info

This commit is contained in:
Sniffleupagus
2023-12-12 19:37:56 -08:00
committed by Jeroen Oudshoorn
parent b2fe8968b7
commit 6591ea2e37

View File

@ -44,8 +44,10 @@ class Client(object):
self.websocket = "ws://%s:%s@%s:%d/api" % (username, password, hostname, port)
self.auth = HTTPBasicAuth(username, password)
def session(self):
r = requests.get("%s/session" % self.url, auth=self.auth)
# session takes optional argument to pull a sub-dictionary
# ex.: "session/wifi", "session/ble"
def session(self, sess="session"):
r = requests.get("%s/%s" % (self.url, sess), auth=self.auth)
return decode(r)
async def start_websocket(self, consumer):