openalex: Handle missing primary location dict

This commit is contained in:
Mattéo Delabre 2023-07-23 12:07:04 +02:00
parent beb0cfeec9
commit 6f7852eedb
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
1 changed files with 4 additions and 1 deletions

View File

@ -141,7 +141,10 @@ class APIClient:
sorted(abstract_forward.items()), sorted(abstract_forward.items()),
)) ))
if work["primary_location"]["source"] is not None: if (
work["primary_location"] is not None
and work["primary_location"]["source"] is not None
):
source = work["primary_location"]["source"]["display_name"] source = work["primary_location"]["source"]["display_name"]
results.append({ results.append({