7
7
8
8
import requests
9
9
from retrying import retry
10
- from warnings import warn
11
10
12
11
from jupiterone .errors import (
13
12
JupiterOneClientError ,
@@ -38,7 +37,7 @@ class JupiterOneClient:
38
37
39
38
# pylint: disable=too-many-instance-attributes
40
39
41
- DEFAULT_URL = "https://api .us.jupiterone.io"
40
+ DEFAULT_URL = "https://graphql .us.jupiterone.io"
42
41
43
42
RETRY_OPTS = {
44
43
"wait_exponential_multiplier" : 1000 ,
@@ -55,7 +54,7 @@ def __init__(self, account: str = None, token: str = None, url: str = DEFAULT_UR
55
54
self .rules_endpoint = self .url + "/rules/graphql"
56
55
self .headers = {
57
56
"Authorization" : "Bearer {}" .format (self .token ),
58
- "LifeOmic -Account" : self .account ,
57
+ "Jupiterone -Account" : self .account ,
59
58
}
60
59
61
60
@property
@@ -120,7 +119,12 @@ def _execute_query(self, query: str, variables: Dict = None) -> Dict:
120
119
)
121
120
122
121
elif response .status_code in [429 , 503 ]:
123
- raise JupiterOneApiRetryError ("JupiterOne API rate limit exceeded" )
122
+ print (response .status_code )
123
+ print (response .content )
124
+ raise JupiterOneApiRetryError ("JupiterOne API rate limit exceeded." )
125
+
126
+ elif response .status_code in [504 ]:
127
+ raise JupiterOneApiRetryError ("Bad Gateway error. Check network route and try again." )
124
128
125
129
elif response .status_code in [500 ]:
126
130
raise JupiterOneApiError ("JupiterOne API internal server error." )
0 commit comments