summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--e3372.py23
-rw-r--r--main.py18
2 files changed, 28 insertions, 13 deletions
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)
diff --git a/main.py b/main.py
index ecf601e..2d8bf8c 100644
--- a/main.py
+++ b/main.py
@@ -13,13 +13,19 @@ def main():
client = WebAPI(args.ip)
client.auth()
- messages = client.get_sms()
+ info = client.device_information()
+ signal = client.device_signal()
- for m in messages:
- print(f"phone: {m.phone}")
- print(f"date: {m.date} ({m.timestamp()})")
- print(f"content: {m.content}")
- print('-----')
+ print(info)
+ print(signal)
+
+ # messages = client.get_sms()
+ #
+ # for m in messages:
+ # print(f"phone: {m.phone}")
+ # print(f"date: {m.date} ({m.timestamp()})")
+ # print(f"content: {m.content}")
+ # print('-----')
if __name__ == '__main__':