Skip to content

Commit c65421d

Browse files
committed
MOD: Update to client library warning message
1 parent 657713f commit c65421d

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

databento/historical/api/timeseries.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from databento.common.parsing import datetime_to_string, optional_symbols_list_to_string
1010
from databento.common.validation import validate_enum
1111
from databento.historical.api import API_VERSION
12+
from databento.historical.error import BentoWarning
1213
from databento.historical.http import BentoHttpAPI
1314

1415

@@ -238,14 +239,13 @@ def _pre_check_data_size( # noqa (prefer not to make static)
238239
or _is_large_number_of_symbols(symbols)
239240
):
240241
warnings.warn(
241-
"\nThe size of the current streaming request is estimated "
242-
"to be 5 GB or greater. We recommend smaller "
243-
"individual streaming request sizes, or alternatively "
244-
"submit a batch download request."
245-
"\nYou can check the uncompressed binary size of a request "
246-
"through the metadata API (from the client library, or over "
247-
"HTTP).\nThis warning can be suppressed "
242+
message="The size of this streaming request is estimated "
243+
"to be 5 GB or greater.\nWe recommend breaking your request "
244+
"into smaller requests, or submitting a batch download request.\n"
245+
"This warning can be suppressed: "
248246
"https://docs.python.org/3/library/warnings.html",
247+
category=BentoWarning,
248+
stacklevel=3, # this makes the error happen in user code
249249
)
250250

251251

databento/historical/error.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,11 @@ def __init__(
9999
message=message,
100100
headers=headers,
101101
)
102+
103+
104+
class BentoWarning(Warning):
105+
"""
106+
Represents a Databento specific warning.
107+
"""
108+
109+
pass

0 commit comments

Comments
 (0)