File tree 1 file changed +18
-9
lines changed
1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -12,17 +12,26 @@ def period_start(period):
12
12
13
13
if response .status_code == 200 :
14
14
data = json .loads (response .content )
15
- startUri = data ["result" ]["primaryTopic" ]["hasBeginning" ]["_about" ] + "Time"
16
-
17
- response = requests .get (api_root + startUri )
18
-
19
- if response .status_code == 200 :
20
- data = json .loads (response .content )
21
- return (data ["result" ]["primaryTopic" ]["numericPosition" ])
22
- else :
23
- print ("Could not load beginning from: " + startUri )
15
+ try :
16
+ startUri = data ["result" ]["primaryTopic" ]["hasBeginning" ]["_about" ] + "Time"
17
+
18
+ response = requests .get (api_root + startUri )
19
+
20
+ if response .status_code == 200 :
21
+ data = json .loads (response .content )
22
+ try :
23
+ return (data ["result" ]["primaryTopic" ]["numericPosition" ])
24
+ except :
25
+ print ("Could not load numericPosition from : " + startUri )
26
+ return 0
27
+ else :
28
+ print ("Could not load beginning from: " + startUri )
29
+ return 0
30
+ except :
31
+ print ("Could not load beginning for: " + period )
24
32
return 0
25
33
34
+
26
35
else :
27
36
print ("Could not load info from: " + period )
28
37
return 0
You can’t perform that action at this time.
0 commit comments