From e14a03c912d49c09c056e8ce1cf62a8e6ca2adfe Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Mon, 1 Mar 2021 23:15:54 +0100 Subject: [PATCH] pagination --- setup-scripts/blocklist-airtable.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup-scripts/blocklist-airtable.py b/setup-scripts/blocklist-airtable.py index 8ca2b41a..b684a466 100755 --- a/setup-scripts/blocklist-airtable.py +++ b/setup-scripts/blocklist-airtable.py @@ -15,7 +15,7 @@ async def block_skylinks_from_airtable(): print("Pulling blocked skylinks from airtable via api integration") headers = { "Authorization": "Bearer " + AIRTABLE_API_KEY } skylinks = [] - offset = '' + offset = None while len(skylinks) == 0 or offset: query = '&'.join(['fields%5B%5D=' + AIRTABLE_FIELD, ('offset=' + offset) if offset else '']) airtable = requests.get( @@ -32,9 +32,9 @@ async def block_skylinks_from_airtable(): if len(skylinks) == 0: return print("Airtable returned 0 skylinks - make sure your configuration is correct") - print(airtable_data.offset) - offset = airtable_data.offset - print(airtable_data.offset) + print(offset) + offset = airtable_data.get('offset') + print(offset) print("Airtable returned " + str(len(skylinks)) + " skylinks to block")