|
@@ -4,10 +4,18 @@ import urllib.error
|
4
|
4
|
import json
|
5
|
5
|
|
6
|
6
|
def get_jsonp_file(url, temp_fname, use_old, allow_old=True):
|
7
|
|
- return get_file(url, temp_fname, use_old, jsonp_load, allow_old)
|
|
7
|
+ try:
|
|
8
|
+ return get_file(url, temp_fname, use_old, jsonp_load, allow_old)
|
|
9
|
+ except json.decoder.JSONDecodeError as e:
|
|
10
|
+ print("Failed to parse JSON from {}".format(temp_fname))
|
|
11
|
+ raise
|
8
|
12
|
|
9
|
13
|
def get_json_file(url, temp_fname, use_old, allow_old=True):
|
10
|
|
- return get_file(url, temp_fname, use_old, json.load, allow_old)
|
|
14
|
+ try:
|
|
15
|
+ return get_file(url, temp_fname, use_old, json.load, allow_old)
|
|
16
|
+ except json.decoder.JSONDecodeError as e:
|
|
17
|
+ print("Failed to parse JSON from {}".format(temp_fname))
|
|
18
|
+ raise
|
11
|
19
|
|
12
|
20
|
def jsonp_load(fp):
|
13
|
21
|
return json.loads(fp.read()[1:-2])
|