File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,15 @@ def parse_json(response):
5252 """
5353 response_json = None
5454 try :
55- response_json = response .json ()
55+ if response is not None :
56+ response_json = response .json ()
5657 except ValueError as err :
57- logging .error (
58- "Error parsing response JSON: %s. Body text: %s" , err , response .text
59- )
58+ if response is not None :
59+ logging .error (
60+ "Error parsing response JSON: %s. Body text: %s" , err , response .text
61+ )
62+ else :
63+ logging .error ("Error parsing response JSON: %s. Response is None" , err )
6064 return response_json
6165
6266
@@ -817,6 +821,12 @@ def get_bitstreams(
817821 if "bitstreams" in bundle .links :
818822 url = bundle .links ["bitstreams" ]["href" ]
819823 else :
824+ if bundle is None :
825+ logging .error ("Bundle cannot be None" )
826+ return []
827+ if bundle is None :
828+ logging .error ("Bundle cannot be None" )
829+ return []
820830 url = f"{ self .API_ENDPOINT } /core/bundles/{ bundle .uuid } /bitstreams"
821831 logging .warning (
822832 "Cannot find bundle bitstream links, will try to construct manually: %s" ,
You can’t perform that action at this time.
0 commit comments