Skip to content

Commit 0296c2b

Browse files
good suggestions
1 parent 4a2e0fb commit 0296c2b

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/groundlight/experimental_api.py

+1-16
Original file line numberDiff line numberDiff line change
@@ -1064,24 +1064,9 @@ def get_raw_headers(self) -> dict:
10641064
headers["Accept"] = "application/json"
10651065
return headers
10661066

1067-
def make_raw_rest_request(self, method: str, endpoint: str, body: Union[dict, None] = None) -> dict:
1068-
"""
1069-
Make a raw REST request to the specified URL
1070-
1071-
:param method: the HTTP method to use
1072-
:param endpoint: the endpoint to send the request to - the url path appended after the
1073-
endpoint including a / at the beginging
1074-
:param body: the request body
1075-
1076-
:return: a dictionary containing the raw response
1077-
"""
1078-
headers = self.get_raw_headers()
1079-
url = f"{self.api_client.configuration.host}{endpoint}"
1080-
response = requests.request(method, url, headers=headers, json=body)
1081-
return response.json()
1082-
10831067
def make_generic_api_request( # noqa: PLR0913 # pylint: disable=too-many-arguments
10841068
self,
1069+
*,
10851070
endpoint: str,
10861071
method: str,
10871072
headers: Union[dict, None] = None,

test/unit/test_customizable_request.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def test_invalid_endpoint_config():
9-
print(gl.make_generic_api_request("/v1/me", "GET"))
10-
print(gl.make_generic_api_request("/v1/detectors", "GET"))
9+
print(gl.make_generic_api_request(endpoint="/v1/me", method="GET"))
10+
print(gl.make_generic_api_request(endpoint="/v1/detectors", method="GET"))
1111
name = f"Test {datetime.utcnow()}"
12-
print(gl.make_generic_api_request("/v1/detector-groups", "POST", body={"name": name}))
12+
print(gl.make_generic_api_request(endpoint="/v1/detector-groups", method="POST", body={"name": name}))

0 commit comments

Comments
 (0)