Added timeout to get request

This commit is contained in:
jeancf 2022-11-02 18:38:23 +01:00
parent b386eae528
commit 9c2438382e

View File

@ -342,10 +342,13 @@ def main(argv):
# Download twitter page of user.
try:
twit_account_page = session.get(url, headers=headers)
twit_account_page = session.get(url, headers=headers, timeout=5)
except requests.exceptions.ConnectionError:
logging.fatal('Host did not respond when trying to download ' + url)
exit(-1)
except requests.exceptions.Timeout:
logging.fatal(nitter_url + ' took too long to respond')
exit(-1)
# Verify that download worked
if twit_account_page.status_code != 200: