Limit page size to 100, for fetching Person records from NB API
apparently that is the effective limit..so must honor it
This commit is contained in:
parent
a7071d140b
commit
6cd71ea4c2
|
@ -103,7 +103,8 @@ class NationBuilderCachePersonImporter(FromNationBuilder, nationbuilder_importin
|
|||
] + primary_address_fields
|
||||
|
||||
def get_host_objects(self):
|
||||
return self.nationbuilder.get_people(page_size=500)
|
||||
return self.nationbuilder.get_people(page_size=100,
|
||||
progress=self.progress)
|
||||
|
||||
def normalize_host_object(self, person):
|
||||
|
||||
|
|
|
@ -95,6 +95,10 @@ class NationBuilderWebAPI(object):
|
|||
|
||||
https://apiexplorer.nationbuilder.com/nationbuilder#People
|
||||
"""
|
||||
# nb. found this limit in practice, but it is not documented?!
|
||||
if page_size > 100:
|
||||
raise ValueError("page_size cannot be more than 100")
|
||||
|
||||
response = self.get('/api/v1/people/count')
|
||||
count = response.json()['people_count']
|
||||
pages = count // page_size
|
||||
|
|
Loading…
Reference in a new issue