Skip to content
This repository was archived by the owner on Mar 30, 2023. It is now read-only.

Commit 543a471

Browse files
author
Jason Costello
committed
Moving remaining resources over to cls.request() method
for improved exception visibility
1 parent 159ead8 commit 543a471

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

hypervector/resources/core/benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ def assert_equal(self, output_to_assert):
5959
output_to_assert = output_to_assert.tolist()
6060

6161
data = {"output_to_assert": output_to_assert}
62-
response = requests.post(endpoint, json=data, headers=self.get_headers()).json()
62+
response = self.request(endpoint, method=requests.post, json=data)
6363
return response

hypervector/resources/core/definition.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def new(cls, definition, project_uuid=None):
5757
"definition": definition_json,
5858
"project_uuid": project_uuid
5959
}
60-
response = requests.post(endpoint, json=data, headers=cls.get_headers()).json()
60+
61+
response = cls.request(endpoint, method=requests.post, json=data)
6162
return cls.from_response(response)
6263

6364
def history(self):

hypervector/resources/core/ensemble.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ def list(cls, definition):
5757
def new(cls, definition_uuid, size):
5858
endpoint = f"{hypervector.API_BASE}/definition/{definition_uuid}/ensembles/add"
5959
data = {"size": size}
60-
response = requests.post(endpoint, json=data, headers=cls.get_headers()).json()
60+
response = cls.request(endpoint, method=requests.post, json=data)
6161
return cls.from_response(response)
6262

6363
def hypervectors(self):
6464
endpoint = f"{hypervector.API_BASE}/ensemble/{self.ensemble_uuid}/data"
65-
response = requests.get(endpoint, headers=self.get_headers()).json()
65+
response = self.request(endpoint)
6666
return response['hypervectors']
6767

6868

0 commit comments

Comments
 (0)