summaryrefslogtreecommitdiff
path: root/s2.py
diff options
context:
space:
mode:
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: