summaryrefslogtreecommitdiff
path: root/s2.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-11-05 23:35:06 +0100
committerJules Laplace <julescarbon@gmail.com>2018-11-05 23:35:06 +0100
commit4e7350603f294fa6eea31146f41711b79d9e1c64 (patch)
treebdf0c52a86abe93ac703b53f6520ed48ebdb67f9 /s2.py
parenta7529c979563e87fe9c518a3b6a084772d4b63a4 (diff)
parent3d98d3753e58922fcd7620b0b7562ec58223e80e (diff)
Merge branch 'master' of asdf.us:megapixels_dev
Diffstat (limited to 's2.py')
-rw-r--r--s2.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/s2.py b/s2.py
index f3b1176f..ca03e22e 100644
--- a/s2.py
+++ b/s2.py
@@ -122,8 +122,11 @@ class SemanticScholarAPI(object):
@staticmethod
def fetch_file(url, fn, **kwargs):
- resp = requests.get(url, params=kwargs, headers=SemanticScholarAPI.headers, verify=False)
- if resp.status_code != 200:
+ try:
+ resp = requests.get(url, params=kwargs, headers=SemanticScholarAPI.headers, verify=False)
+ if resp.status_code != 200:
+ return None
+ except:
return None
size = 0
with open(fn, 'wb') as f: