Add a try-except to check for network errors

This commit is contained in:
gottagofaster236
2020-10-20 20:26:28 +03:00
parent 1511384e30
commit 2e81610fc6

View File

@@ -32,7 +32,10 @@ def send_minute_watched_events():
if is_online(streamer_login):
# print(f"Watching minute for {streamer_login}")
request_info = minute_watched_requests[streamer_login]
requests.post(request_info.url, data=request_info.payload, headers=headers)
try:
requests.post(request_info.url, data=request_info.payload, headers=headers)
except requests.exceptions.ConnectionError as e:
print("Error while trying to watch a minute:", str(e))
elif minutes_passed % 5 == 0:
# checking whether the streamer is online every 5 minutes
check_online(streamer_login)