Skip to content

Commit 05d2d90

Browse files
authored
Update J1QLdeferredResponse.py
1 parent 5f42b84 commit 05d2d90

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/J1QLdeferredResponse.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import time
3-
43
import requests
54
from requests.adapters import HTTPAdapter, Retry
65

@@ -9,7 +8,7 @@
98
token = os.environ.get("JUPITERONE_TOKEN")
109

1110
# JupiterOne GraphQL API:
12-
j1_graphql_url = "https://graphql.dev.jupiterone.io"
11+
j1_graphql_url = "https://graphql.us.jupiterone.io"
1312

1413
# JupiterOne GraphQL API headers
1514
j1_graphql_headers = {
@@ -38,7 +37,7 @@
3837
"""
3938

4039
gql_variables = {
41-
"query": "find (snyk_finding | snyk_finding_coordinate | insightvm_finding | github_finding | semgrep_finding)",
40+
"query": "FIND Finding",
4241
"deferredResponse": "FORCE",
4342
"cursor": "",
4443
"flags": {
@@ -50,6 +49,7 @@
5049
"query": gql_query,
5150
"variables": gql_variables
5251
}
52+
5353
all_query_results = []
5454
cursor = None
5555

@@ -62,7 +62,7 @@
6262
s.mount('https://', HTTPAdapter(max_retries=retries))
6363
url_response = s.post(j1_graphql_url, headers=j1_graphql_headers, json=payload)
6464
download_url = url_response.json()['data']['queryV1']['url']
65-
print(download_url)
65+
# print(download_url)
6666

6767
download_response = s.get(download_url).json()
6868

@@ -76,15 +76,15 @@
7676
status = download_response['status'] # update 'status' for next iteration
7777

7878
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']))
8080

8181
# Update cursor from response
8282
if 'cursor' in download_response:
8383
cursor = download_response['cursor']
84-
print(cursor)
84+
# print(cursor)
8585

8686
else:
8787
break
8888

89-
# print(all_query_results)
89+
print(all_query_results)
9090
print(len(all_query_results))

0 commit comments

Comments
 (0)