From a463ce335b906240a51ec0b39c9cef664e00a1e8 Mon Sep 17 00:00:00 2001 From: jeancf Date: Sat, 16 Oct 2021 19:26:02 +0200 Subject: [PATCH] Catching connection exception to nitter site --- twoot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/twoot.py b/twoot.py index 8c45545..2cfb68d 100755 --- a/twoot.py +++ b/twoot.py @@ -328,7 +328,11 @@ def main(argv): url += '/with_replies' # Download twitter page of user. - twit_account_page = session.get(url, headers=headers) + try: + twit_account_page = session.get(url, headers=headers) + except requests.exceptions.ConnectionError: + logging.fatal('Host did not respond when trying to download ' + url) + exit(-1) # Verify that download worked if twit_account_page.status_code != 200: