|
1 | 1 | import os |
2 | 2 | import time |
3 | | - |
4 | 3 | import requests |
5 | 4 | from requests.adapters import HTTPAdapter, Retry |
6 | 5 |
|
|
9 | 8 | token = os.environ.get("JUPITERONE_TOKEN") |
10 | 9 |
|
11 | 10 | # JupiterOne GraphQL API: |
12 | | -j1_graphql_url = "https://graphql.dev.jupiterone.io" |
| 11 | +j1_graphql_url = "https://graphql.us.jupiterone.io" |
13 | 12 |
|
14 | 13 | # JupiterOne GraphQL API headers |
15 | 14 | j1_graphql_headers = { |
|
38 | 37 | """ |
39 | 38 |
|
40 | 39 | gql_variables = { |
41 | | - "query": "find (snyk_finding | snyk_finding_coordinate | insightvm_finding | github_finding | semgrep_finding)", |
| 40 | + "query": "FIND Finding", |
42 | 41 | "deferredResponse": "FORCE", |
43 | 42 | "cursor": "", |
44 | 43 | "flags": { |
|
50 | 49 | "query": gql_query, |
51 | 50 | "variables": gql_variables |
52 | 51 | } |
| 52 | + |
53 | 53 | all_query_results = [] |
54 | 54 | cursor = None |
55 | 55 |
|
|
62 | 62 | s.mount('https://', HTTPAdapter(max_retries=retries)) |
63 | 63 | url_response = s.post(j1_graphql_url, headers=j1_graphql_headers, json=payload) |
64 | 64 | download_url = url_response.json()['data']['queryV1']['url'] |
65 | | - print(download_url) |
| 65 | + # print(download_url) |
66 | 66 |
|
67 | 67 | download_response = s.get(download_url).json() |
68 | 68 |
|
|
76 | 76 | status = download_response['status'] # update 'status' for next iteration |
77 | 77 |
|
78 | 78 | all_query_results.extend(download_response['data']) # add results to all results list |
79 | | - print(len(download_response['data'])) |
| 79 | + # print(len(download_response['data'])) |
80 | 80 |
|
81 | 81 | # Update cursor from response |
82 | 82 | if 'cursor' in download_response: |
83 | 83 | cursor = download_response['cursor'] |
84 | | - print(cursor) |
| 84 | + # print(cursor) |
85 | 85 |
|
86 | 86 | else: |
87 | 87 | break |
88 | 88 |
|
89 | | -# print(all_query_results) |
| 89 | +print(all_query_results) |
90 | 90 | print(len(all_query_results)) |
0 commit comments