Skip to content

Commit

Permalink
Merge pull request #96 from MAAP-Project/feature/pagination
Browse files Browse the repository at this point in the history
added pagination to listJobs endpoint
  • Loading branch information
marjo-luc authored Jul 11, 2024
2 parents 61191f4 + 471ce47 commit 8dc3acf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions maap/maap.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,21 @@ def cancelJob(self, jobid):
job.id = jobid
return job.cancel_job()

def listJobs(self, username=None):
def listJobs(self, username=None, page_size=None, offset=None):
if username==None and self.profile is not None and 'username' in self.profile.account_info().keys():
username = self.profile.account_info()['username']

url = os.path.join(self.config.dps_job, username, endpoints.DPS_JOB_LIST)
params = {k: v for k, v in (("page_size", page_size), ("offset", offset)) if v}

headers = self._get_api_header()
logger.debug('GET request sent to {}'.format(url))
logger.debug('headers:')
logger.debug(headers)
response = requests.get(
url=url,
headers=headers
headers=headers,
params=params,
)
return response

Expand Down

0 comments on commit 8dc3acf

Please sign in to comment.