Skip to content

Commit

Permalink
Fix: duplicated entries returned by API if pagination offset > total …
Browse files Browse the repository at this point in the history
…number of elements
  • Loading branch information
Philip Flohr committed Jan 14, 2021
1 parent 9de540f commit aa801a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/personio_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ def request_paginated(
resp_data = response['data']
if resp_data:
data_acc.extend(resp_data)
params['offset'] += len(resp_data)
if response['metadata']['current_page'] == response['metadata']['total_pages']:
break
else:
params['offset'] += len(resp_data)
else:
break
# return the accumulated data
Expand Down

0 comments on commit aa801a7

Please sign in to comment.