-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathsample.py
More file actions
30 lines (20 loc) · 679 Bytes
/
sample.py
File metadata and controls
30 lines (20 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pprint import pprint
from huaweisms.api import monitoring, sms, user
from huaweisms.api.common import ApiCtx
USER = "admin"
PASSWORD = "your_admin_password"
PHONE_NUMBER = "+1308888888"
# BEFORE running, do MAKE SURE heaweisms.api.config has the CORRECT VALUES for your MODEM
def get_session():
return user.quick_login(USER, PASSWORD)
def valid_context(ctx):
# type: (ApiCtx) -> bool
sl = user.state_login(ctx)
if sl["type"] == "response" and sl["response"]["State"] != -1:
return True
return False
ctx = get_session()
sent = sms.send_sms(ctx, PHONE_NUMBER, "This is a test")
pprint(sent)
status = monitoring.status(ctx)
pprint(status)