diff options
author | Matt Singleton <msingleton@aclu.org> | 2017-10-14 20:11:36 -0400 |
---|---|---|
committer | Matt Singleton <msingleton@aclu.org> | 2017-10-14 20:11:36 -0400 |
commit | 9b1d5f761b4e506154536388ef3363ea4a929d2b (patch) | |
tree | a0797590e4b453acbb670411b7dcedb44f614400 | |
parent | 4e8bb9297e5e55bbd4aafacf1b77e63add5cbfe0 (diff) |
timeout requests, closes #13
-rw-r--r-- | unbiased/sources/base.py | 2 | ||||
-rw-r--r-- | 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:
|