-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
22 lines (16 loc) · 889 Bytes
/
Copy pathserver.py
File metadata and controls
22 lines (16 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from twilio.rest import Client
from time import gmtime, strftime
from env_variables import _SETTINGS
from sunsetwx import *
client = Client(_SETTINGS["SID"], _SETTINGS["token"])
def getMsg(type, time, quality, temprature):
return type + ": " + time + " | " + quality + " | " + str(temprature) + "C"
qualityObj = main()
sunsetMsg = getMsg("sunset", qualityObj["sunset"]["valid_at"], qualityObj["sunset"]["quality"], qualityObj["sunset"]["temperature"])
sunriseMsg = getMsg("sunrise", qualityObj["sunrise"]["valid_at"], qualityObj["sunrise"]["quality"], qualityObj["sunrise"]["temperature"])
client.messages.create(to=_SETTINGS["to_number"],
from_=_SETTINGS["from_number"],
body=sunsetMsg)
client.messages.create(to=_SETTINGS["to_number"],
from_=_SETTINGS["from_number"],
body=sunriseMsg)