From 830f34b48ea81e40263f91b37e6a87233f19506d Mon Sep 17 00:00:00 2001 From: deedy5 <65482418+deedy5@users.noreply.github.com> Date: Tue, 17 Aug 2021 07:50:07 +0300 Subject: [PATCH] Update fake_traffic.py --- fake_traffic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fake_traffic.py b/fake_traffic.py index 54e61d0..1a7eec9 100644 --- a/fake_traffic.py +++ b/fake_traffic.py @@ -22,7 +22,7 @@ def get_url(url): if resp.status_code == 200: print(resp.status_code, url) return resp - except requests.ConnectionError: + except requests.exceptions.ConnectionError: print("Connection error. Sleep 60 sec.") sleep(60) except: @@ -94,6 +94,7 @@ def fake_traffic(country='US', language='en-US'): for i, url in enumerate(article_urls, start=1): recursive_browse(url) print(f"{i}/{len(article_urls)} urls recursive browsing.") + sleep(uniform(1, 5)) if __name__ == '__main__': fake_traffic(country='US', language='en-US')