pagination
This commit is contained in:
parent
3b5d09ec73
commit
e14a03c912
|
@ -15,7 +15,7 @@ async def block_skylinks_from_airtable():
|
||||||
print("Pulling blocked skylinks from airtable via api integration")
|
print("Pulling blocked skylinks from airtable via api integration")
|
||||||
headers = { "Authorization": "Bearer " + AIRTABLE_API_KEY }
|
headers = { "Authorization": "Bearer " + AIRTABLE_API_KEY }
|
||||||
skylinks = []
|
skylinks = []
|
||||||
offset = ''
|
offset = None
|
||||||
while len(skylinks) == 0 or offset:
|
while len(skylinks) == 0 or offset:
|
||||||
query = '&'.join(['fields%5B%5D=' + AIRTABLE_FIELD, ('offset=' + offset) if offset else ''])
|
query = '&'.join(['fields%5B%5D=' + AIRTABLE_FIELD, ('offset=' + offset) if offset else ''])
|
||||||
airtable = requests.get(
|
airtable = requests.get(
|
||||||
|
@ -32,9 +32,9 @@ async def block_skylinks_from_airtable():
|
||||||
if len(skylinks) == 0:
|
if len(skylinks) == 0:
|
||||||
return print("Airtable returned 0 skylinks - make sure your configuration is correct")
|
return print("Airtable returned 0 skylinks - make sure your configuration is correct")
|
||||||
|
|
||||||
print(airtable_data.offset)
|
print(offset)
|
||||||
offset = airtable_data.offset
|
offset = airtable_data.get('offset')
|
||||||
print(airtable_data.offset)
|
print(offset)
|
||||||
|
|
||||||
print("Airtable returned " + str(len(skylinks)) + " skylinks to block")
|
print("Airtable returned " + str(len(skylinks)) + " skylinks to block")
|
||||||
|
|
||||||
|
|
Reference in New Issue