-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
39 lines (31 loc) · 812 Bytes
/
bot.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
37
38
39
import tweepy
import logging
import config
import lot
def main():
try:
nl = lot.NiceLot()
except Exception as e:
logging.exception("Lot not created")
raise e
try:
nl.get_image(lot.google_key)
except Exception as e:
logging.exception("Error while getting image from Google")
raise e
try:
nl.prep_tweet(lot.twitter_api)
except Exception as e:
logging.exception("Error while preparing tweet")
raise e
try:
nl.post_tweet(lot.twitter_api)
except Exception as e:
logging.exception("Error while posting tweet")
try:
nl.mark_as_tweeted()
except Exception as e:
logging.exception("Error while marking lot tweeted")
raise e
if __name__ == '__main__':
main()