handling tweepy errors
handling tweepy tweeting errors with "try".
This commit is contained in:
parent
57bf735a1b
commit
607bc6882a
1 changed files with 9 additions and 3 deletions
6
main.py
6
main.py
|
@ -92,8 +92,11 @@ while True:
|
|||
int( time_now + 3600 )).strftime('%Y-%m-%d %H:%M:%S') + "]"
|
||||
|
||||
print("Text:", text)
|
||||
try:
|
||||
api.update_status(text)
|
||||
# same text as before cannot be posted!
|
||||
except:
|
||||
print(time_now, "did not tweet closing status")
|
||||
|
||||
log(str(time_now) + ";" + str(data_space["state"]["lastchange"]) + ";" + str(data_space["state"]["open"])
|
||||
+ ";" + str(number) + "\n")
|
||||
|
@ -109,7 +112,10 @@ while True:
|
|||
int( time_now + 3600 )).strftime('%Y-%m-%d %H:%M:%S') + "]"
|
||||
|
||||
print("Text:", text)
|
||||
try:
|
||||
api.update_status(text)
|
||||
except:
|
||||
print(time_now, "did not tweet opening status")
|
||||
|
||||
log(str(time_now) + ";" + str(data_space["state"]["lastchange"]) + ";" + str(data_space["state"]["open"])
|
||||
+ ";" + str(number) + "\n")
|
||||
|
|
Reference in a new issue