From 6f7852eedbeaee6ee7bb99ffa7e93c2384a852d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Sun, 23 Jul 2023 12:07:04 +0200 Subject: [PATCH] openalex: Handle missing primary location dict --- feedleware/openalex/openalex.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/feedleware/openalex/openalex.py b/feedleware/openalex/openalex.py index 447bd6a..b8e3726 100644 --- a/feedleware/openalex/openalex.py +++ b/feedleware/openalex/openalex.py @@ -141,7 +141,10 @@ class APIClient: 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"] results.append({