From 71a26b49d933eb4f9c59e8d7e18c4fcd2d149d34 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Tue, 23 Mar 2021 02:08:53 +0300 Subject: upd --- e3372.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'e3372.py') diff --git a/e3372.py b/e3372.py index adc07c6..61be161 100644 --- a/e3372.py +++ b/e3372.py @@ -28,13 +28,12 @@ class WebAPI: 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 device_information(self): + return self.request('device/information') + + def device_signal(self): + return self.request('device/signal') + def get_sms(self, count=10, page=1): request = build_request({ @@ -63,6 +62,16 @@ class WebAPI: def send_sms(self): pass + def dataswitch(self, on=True): + return self.request('dialup/mobile-dataswitch', data=build_request({ + 'dataswitch': 1 if on else 0 + })) + + def reboot(self): + return self.request('device/control', data=build_request({ + 'Control': 1 + })) + def request(self, endpoint: str, data=None): url = f'http://{self.ip}/api/{endpoint}' r = requests.get(url, headers=self.headers) if data is None else requests.post(url, data=data, headers=self.headers) -- cgit v1.2.3