File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 99from databento .common .parsing import datetime_to_string , optional_symbols_list_to_string
1010from databento .common .validation import validate_enum
1111from databento .historical .api import API_VERSION
12+ from databento .historical .error import BentoWarning
1213from 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- "\n The 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- "\n You can check the uncompressed binary size of a request "
246- "through the metadata API (from the client library, or over "
247- "HTTP).\n This warning can be suppressed "
242+ message = "The size of this streaming request is estimated "
243+ "to be 5 GB or greater.\n We 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments