-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendAlertMessage.py
36 lines (32 loc) · 1.12 KB
/
sendAlertMessage.py
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
31
32
33
34
35
36
from fireAPI import *
from search import *
from sendMessage import *
from fireAPI import *
resultList = listsManager()
location = resultList[1]
def warningMessage():
if not resultList[4]:
warning = ('Warning!! ' + (str(resultList[0])).upper() + ' wildfire named '
+ str(resultList[1]) + 'discovered around '
+ str(distanceList[3])
+ 'km away from your location and no information has been found regarding the containment.')
else:
warning = ('Warning ' + str(resultList[0]) + ' wildfire named '
+ str(resultList[1]) + 'discovered '
+ ' around ' + str(distanceList[3])
+ 'km away from your location and it is '
+ str(resultList[4]) + ' % contained')
return warning
def tweetMessage():
tweets = search(location + ' wildfire ')
numTweets = len(tweets)
finalMessage = ''
for x in range (numTweets):
tweetText= str(x+1) + '. ' + str(tweets[x]) +'\n'
finalMessage = finalMessage + tweetText
finalMessage = 'Here is what Twitter has to say: \n'+ finalMessage
# print(finalMessage)
return finalMessage
# print(warning)
sendMessage(warningMessage())
sendMessage(tweetMessage())