diff --git a/BeautifulSoup/scrape.py b/BeautifulSoup/scrape.py index 42a191f1c..86a15e4ae 100644 --- a/BeautifulSoup/scrape.py +++ b/BeautifulSoup/scrape.py @@ -2,7 +2,7 @@ import requests import csv -source = requests.get('http://coreyms.com').text +source = requests.get('http://coreyms.com', timeout=60).text soup = BeautifulSoup(source, 'lxml') diff --git a/Python-Unit-Testing/employee.py b/Python-Unit-Testing/employee.py index 0470fe328..e207d42bd 100644 --- a/Python-Unit-Testing/employee.py +++ b/Python-Unit-Testing/employee.py @@ -24,7 +24,7 @@ def apply_raise(self): self.pay = int(self.pay * self.raise_amt) def monthly_schedule(self, month): - response = requests.get(f'http://company.com/{self.last}/{month}') + response = requests.get(f'http://company.com/{self.last}/{month}', timeout=60) if response.ok: return response.text else: diff --git a/Python/Threading/download-images.py b/Python/Threading/download-images.py index 506acaef1..717f09ab2 100644 --- a/Python/Threading/download-images.py +++ b/Python/Threading/download-images.py @@ -24,7 +24,7 @@ def download_image(img_url): - img_bytes = requests.get(img_url).content + img_bytes = requests.get(img_url, timeout=60).content img_name = img_url.split('/')[3] img_name = f'{img_name}.jpg' with open(img_name, 'wb') as img_file: