Skip to content

Commit

Permalink
Fix headers
Browse files Browse the repository at this point in the history
  • Loading branch information
matveyvarg committed Jul 2, 2024
1 parent c0d8a5f commit 76a443d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions deker_server_adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,13 @@ def read_data(
url = f"{self.path_stripped}/{self.type.name}/by-id/{array.id}/subset/{bounds_}/data"
try:
if self.client.cluster_mode:
response = request_in_cluster(url, array, self.ctx, should_check_status=True)
response = request_in_cluster(
url,
array,
self.ctx,
should_check_status=True,
request_kwargs={"headers": {"Accept": "application/octet-stream"}},
)
else:
response = self.client.get(
f"{self.collection_host}{url}",
Expand All @@ -255,8 +261,8 @@ def read_data(
raise DekerTimeoutServer(
message=f"Timeout on {self.type.name} read {array}",
)
decoded_response = response.read().decode("unicode-escape").replace("[", "").replace("]", "")
numpy_array = np.fromstring(decoded_response, dtype=array.dtype, sep=",") # type: ignore[call-overload]

numpy_array = np.fromstring(response.read(), dtype=array.dtype) # type: ignore[call-overload]
shape = array[bounds].shape
if not shape and numpy_array.size:
return numpy_array[0]
Expand Down

0 comments on commit 76a443d

Please sign in to comment.