Skip to content
Merged
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
3 changes: 3 additions & 0 deletions docarray/array/mixins/io/pushpull.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os.path
import warnings
from collections import Counter
from http import HTTPStatus
from pathlib import Path
from typing import Dict, Type, TYPE_CHECKING, List, Optional, Any

Expand Down Expand Up @@ -250,6 +251,8 @@ def _get_chunk(_batch):
if response.ok:
return response.json()['data']
else:
if response.status_code >= 400 and 'readableMessage' in response.json():
response.reason = response.json()['readableMessage']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u should use HTTPStatus for somehing. There must be some constant from there, 400 seems magic to me

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would've used it if it was an equal check (==).
I think it is more readable to use the actual number in comparison (it just means failed response).
The requests library does the same actually
image

response.raise_for_status()

@classmethod
Expand Down