@@ -340,7 +340,7 @@ def patron_by_pid(pid, known_patrons):
340
340
hit = next (iter (results or []), None )
341
341
if hit :
342
342
known_patrons [pid ] = hit .to_dict ()
343
- return known_patrons [ pid ]
343
+ return known_patrons . get ( pid , {})
344
344
345
345
def location_by_pid (pid , known_locations ):
346
346
"""Get location by pid.
@@ -359,7 +359,7 @@ def location_by_pid(pid, known_locations):
359
359
if hit :
360
360
data = hit .to_dict ()
361
361
known_locations [pid ] = {k : v for k , v in data .items () if v }
362
- return known_locations [ pid ]
362
+ return known_locations . get ( pid , {})
363
363
364
364
def library_name_by_pid (pid , known_libraries ):
365
365
"""Get library name by pid.
@@ -376,7 +376,7 @@ def library_name_by_pid(pid, known_libraries):
376
376
hit = next (iter (results or []), None )
377
377
if hit :
378
378
known_libraries [pid ] = hit .name
379
- return known_libraries [ pid ]
379
+ return known_libraries . get ( pid , {})
380
380
381
381
def holding_by_pid (pid , known_holdings ):
382
382
"""Get holdings by pid.
@@ -394,7 +394,7 @@ def holding_by_pid(pid, known_holdings):
394
394
hit = next (iter (results or []), None )
395
395
if hit :
396
396
known_holdings [pid ] = hit .to_dict ()
397
- return known_holdings [ pid ]
397
+ return known_holdings . get ( pid , {})
398
398
399
399
def item_by_pid (pid , known_items ):
400
400
"""Get item by pid.
@@ -412,7 +412,7 @@ def item_by_pid(pid, known_items):
412
412
.source (includes = fields )\
413
413
.execute ()
414
414
known_items [pid ] = next (iter (results or []), None )
415
- return known_items [ pid ]
415
+ return known_items . get ( pid , {})
416
416
417
417
def item_type_by_pid (pid , known_ittys ):
418
418
"""Get item type by pid.
@@ -427,7 +427,7 @@ def item_type_by_pid(pid, known_ittys):
427
427
.filter ('term' , negative_availability = False )\
428
428
.execute ()
429
429
known_ittys [pid ] = next (iter (results or []), None )
430
- return known_ittys [ pid ]
430
+ return known_ittys . get ( pid , {})
431
431
432
432
metadata = []
433
433
item_pids = []
0 commit comments