|
1 | 1 | from cxone_api import AuthUS, ApiUS, paged_api, CxOneClient
|
2 |
| -from cxone_api.repo import ProjectRepoConfig |
| 2 | +from cxone_api.repo import download_files_to_directory |
3 | 3 | import os, asyncio
|
4 | 4 |
|
5 | 5 |
|
6 | 6 | async def main():
|
7 | 7 | cxone_client = CxOneClient.create_with_oauth(os.environ["OAUTH_CLIENTID"], os.environ["OAUTH_CLIENTSECRET"], "CxOneAPIExample",
|
8 | 8 | AuthUS(os.environ["TENANT"]), ApiUS())
|
9 |
| - |
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 | 9 |
|
| 10 | + # print ((await cxone_client.get_repostore_project_tree("153a99d4-686e-4fe9-970d-c68b5d0f83c7")).json()) |
| 11 | + |
| 12 | + # print((await cxone_client.get_repostore_folder("153a99d4-686e-4fe9-970d-c68b5d0f83c7", "input/client/public")).json()) |
14 | 13 |
|
15 |
| - for scan in cxone_client.get_project_last_scans(limit=20): |
16 |
| - print(f"Scan Id: {scan['id']}") |
17 |
| - pass |
| 14 | + # print((await cxone_client.get_repostore_file("153a99d4-686e-4fe9-970d-c68b5d0f83c7", "input/client/src/index.js")).text) |
| 15 | + |
| 16 | + # async for scan in paged_api(cxone_client.get_scans, "scans", statuses=['Completed']): |
| 17 | + # print(f"Scan Id: {scan['id']} ProjectId: {scan['projectId']} Branch: {scan['branch']}") |
| 18 | + |
| 19 | + # print((await cxone_client.get_scan("153a99d4-686e-4fe9-970d-c68b5d0f83c7")).json()) |
| 20 | + |
| 21 | + # await download_files_to_directory('153a99d4-686e-4fe9-970d-c68b5d0f83c7', 'test') |
| 22 | + |
| 23 | + last_scan_dict = (await cxone_client.get_project_last_scans(limit=20)).json() |
| 24 | + |
| 25 | + for scan in last_scan_dict: |
| 26 | + print(f"Scan Id: {last_scan_dict[scan]}") |
| 27 | + # Paging has to be redone manually without page_api |
| 28 | + |
| 29 | + |
18 | 30 |
|
19 | 31 | asyncio.run(main())
|
0 commit comments