Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions jupiterone/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# see https://github.com/PyCQA/pylint/issues/409

import json
from warnings import warn
from typing import Dict, List

import requests
Expand Down Expand Up @@ -50,11 +51,11 @@ def __init__(self, account: str = None, token: str = None, url: str = DEFAULT_UR
self.account = account
self.token = token
self.url = url
self.query_endpoint = self.url + "/graphql"
self.query_endpoint = self.url
self.rules_endpoint = self.url + "/rules/graphql"
self.headers = {
"Authorization": "Bearer {}".format(self.token),
"Jupiterone-Account": self.account,
"JupiterOne-Account": self.account,
}

@property
Expand Down Expand Up @@ -90,7 +91,7 @@ def _execute_query(self, query: str, variables: Dict = None) -> Dict:
if variables:
data.update(variables=variables)

# Always ask for variableresultsize
# Always ask for variableResultSize
data.update(flags={"variableResultSize": True})

response = requests.post(
Expand Down Expand Up @@ -124,7 +125,7 @@ def _execute_query(self, query: str, variables: Dict = None) -> Dict:
raise JupiterOneApiRetryError("JupiterOne API rate limit exceeded.")

elif response.status_code in [504]:
raise JupiterOneApiRetryError("Bad Gateway error. Check network route and try again.")
raise JupiterOneApiRetryError("Gateway Timeout.")

elif response.status_code in [500]:
raise JupiterOneApiError("JupiterOne API internal server error.")
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

install_reqs = [
'requests',
'retrying',
'warnings'
'retrying'
]

setup(name='jupiterone',
Expand Down
2 changes: 2 additions & 0 deletions tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
pythonpath = ..
2 changes: 1 addition & 1 deletion tests/test_create_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def request_callback(request):
return (200, headers, json.dumps(response))

responses.add_callback(
responses.POST, 'https://api.us.jupiterone.io/graphql',
responses.POST, 'https://graphql.us.jupiterone.io',
callback=request_callback,
content_type='application/json',
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_create_relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def request_callback(request):
return (200, headers, json.dumps(response))

responses.add_callback(
responses.POST, 'https://api.us.jupiterone.io/graphql',
responses.POST, 'https://graphql.us.jupiterone.io',
callback=request_callback,
content_type='application/json',
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_delete_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def request_callback(request):
return (200, headers, json.dumps(response))

responses.add_callback(
responses.POST, 'https://api.us.jupiterone.io/graphql',
responses.POST, 'https://graphql.us.jupiterone.io',
callback=request_callback,
content_type='application/json',
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_delete_relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def request_callback(request):
return (200, headers, json.dumps(response))

responses.add_callback(
responses.POST, 'https://api.us.jupiterone.io/graphql',
responses.POST, 'https://graphql.us.jupiterone.io',
callback=request_callback,
content_type='application/json',
)
Expand Down
Loading