Fix API call to return all Harvest Projects
This commit is contained in:
parent
03066f1135
commit
782cb1fcec
|
@ -122,7 +122,17 @@ class HarvestWebAPI(object):
|
||||||
https://help.getharvest.com/api-v2/projects-api/projects/projects/#list-all-projects
|
https://help.getharvest.com/api-v2/projects-api/projects/projects/#list-all-projects
|
||||||
"""
|
"""
|
||||||
response = self.get('/projects', params=kwargs)
|
response = self.get('/projects', params=kwargs)
|
||||||
return response.json()
|
data = response.json()
|
||||||
|
projects = data['projects']
|
||||||
|
while data['next_page']:
|
||||||
|
|
||||||
|
kw = dict(kwargs)
|
||||||
|
kw['page'] = data['next_page']
|
||||||
|
response = self.get('/projects', params=kw)
|
||||||
|
data = response.json()
|
||||||
|
projects.extend(data['projects'])
|
||||||
|
|
||||||
|
return projects
|
||||||
|
|
||||||
def get_tasks(self, **kwargs):
|
def get_tasks(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -151,7 +151,7 @@ class HarvestProjectImporter(FromHarvest, rattail_harvest_importing.model.Harves
|
||||||
model.HarvestProject.deleted == None))
|
model.HarvestProject.deleted == None))
|
||||||
|
|
||||||
def get_host_objects(self):
|
def get_host_objects(self):
|
||||||
return self.webapi.get_projects()['projects']
|
return self.webapi.get_projects()
|
||||||
|
|
||||||
def normalize_host_object(self, project):
|
def normalize_host_object(self, project):
|
||||||
data = super(HarvestProjectImporter, self).normalize_host_object(project)
|
data = super(HarvestProjectImporter, self).normalize_host_object(project)
|
||||||
|
|
Loading…
Reference in a new issue