Skip to content

Commit 19de70e

Browse files
committed
Added non working get_project_last_scans example
1 parent 68b764b commit 19de70e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

api_example.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ async def main():
77
cxone_client = CxOneClient.create_with_oauth(os.environ["OAUTH_CLIENTID"], os.environ["OAUTH_CLIENTSECRET"], "CxOneAPIExample",
88
AuthUS(os.environ["TENANT"]), ApiUS())
99

10-
async for scan in paged_api(cxone_client.get_scans, "scans", statuses=['Completed']):
11-
print(f"Scan Id: {scan['id']} ProjectId: {scan['projectId']} Branch: {scan['branch']}")
10+
#async for scan in paged_api(cxone_client.get_scans, "scans", statuses=['Completed']):
11+
# print(f"Scan Id: {scan['id']} ProjectId: {scan['projectId']} Branch: {scan['branch']}")
12+
# pass
13+
14+
15+
for scan in cxone_client.get_project_last_scans(limit=20):
16+
print(f"Scan Id: {scan['id']}")
1217
pass
1318

1419
asyncio.run(main())

cxone_api/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ async def update_project(self, id, payload):
365365
async def get_project(self, projectid):
366366
url = urljoin(self.api_endpoint, f"projects/{projectid}")
367367
return await self.__exec_request(requests.get, url)
368+
369+
async def get_project_last_scans(self, **kwargs):
370+
url = urljoin(self.api_endpoint, f"projects/last-scan")
371+
return await self.__exec_request(requests.get, url, json=kwargs)
368372

369373
async def get_project_configuration(self, projectid):
370374
url = urljoin(self.api_endpoint, f"configuration/project?project-id={projectid}")

0 commit comments

Comments
 (0)