mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Added timeout to get request
This commit is contained in:
parent
b386eae528
commit
9c2438382e
5
twoot.py
5
twoot.py
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user