From 9b1d5f761b4e506154536388ef3363ea4a929d2b Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 14 Oct 2017 20:11:36 -0400 Subject: timeout requests, closes #13 --- unbiased/sources/base.py | 2 +- unbiased/util.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unbiased/sources/base.py b/unbiased/sources/base.py index 1d54f82..b5f2d1e 100644 --- a/unbiased/sources/base.py +++ b/unbiased/sources/base.py @@ -61,7 +61,7 @@ class NewsSource(object): @classmethod def _fetch_content(cls, url): - res = requests.get(url) + res = requests.get(url, timeout=3) if res.status_code == 200: content = res.text else: diff --git a/unbiased/util.py b/unbiased/util.py index 12003b1..f3c70c0 100644 --- a/unbiased/util.py +++ b/unbiased/util.py @@ -79,7 +79,7 @@ def write_static_files(outDir): def pullImage(url, index, webroot, target_width=350, target_height=200): - res = requests.get(url) + res = requests.get(url, timeout=3) if res.status_code == 200: content = res.content else: -- cgit v1.2.3