summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--e3372.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/e3372.py b/e3372.py
index 6cfa246..7c9e554 100644
--- a/e3372.py
+++ b/e3372.py
@@ -8,10 +8,24 @@ class E3372:
pass
def auth(self):
- soup = self._request("webserver/SesTokInfo")
- print(soup)
+ response = self.request("webserver/SesTokInfo")
- def _request(self, endpoint: str, method='GET'):
- url = f"http://{self.ip}/api/{endpoint}"
+ cookie = response.find('SesInfo').get_text()
+ token = response.find('TokInfo').get_text()
+
+ self.headers['Cookie'] = cookie
+ self.headers['__RequestVerificationToken'] = token
+ self.headers['Content-Type'] = 'text/xml'
+
+ def device_information(self):
+ response = self.request('device/information')
+ print(response)
+
+ def device_signal(self):
+ response = self.request('device/signal')
+ print(response)
+
+ def request(self, endpoint: str, method='GET'):
+ url = f'http://{self.ip}/api/{endpoint}'
r = requests.get(url) if method == 'GET' else requests.post(url)
- return BeautifulSoup(r.text, "lxml") \ No newline at end of file
+ return BeautifulSoup(r.text, 'xml').find('response') \ No newline at end of file