Skip to content

Commit 68f4029

Browse files
Merge pull request #29 from Seshat-Global-History-Databank/avoid-duplicates
Ensure get_all function doesnt add the same API result more than once
2 parents 3b3e958 + 80ed335 commit 68f4029

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

seshat_api/base_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,9 @@ def get_all(self):
298298
results = response.get('results', [])
299299
if not results:
300300
break
301-
all_results.extend(results)
301+
for result in results:
302+
if result['id'] not in [r['id'] for r in all_results]:
303+
all_results.append(result)
302304
page += 1
303305

304306
return all_results

0 commit comments

Comments
 (0)