Skip to content

Commit 5c2b95d

Browse files
authored
Deprecate the REST/HTTP client (#104)
1 parent ff03633 commit 5c2b95d

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

exabel_data_sdk/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import sys
2+
import warnings
3+
4+
from exabel_data_sdk.util.warnings import ExabelDeprecationWarning
25

36
from .client.exabel_client import ExabelClient
47

58
if sys.version_info.major == 3 and sys.version_info.minor == 6:
6-
import warnings
7-
89
warnings.warn(
910
"Python 3.6 is deprecated as of version 3.3.0 of the Exabel Python SDK. Support will be "
1011
"removed in a future release. Please upgrade to Python 3.7 or a newer release of Python.",
11-
FutureWarning,
12+
ExabelDeprecationWarning,
1213
)

exabel_data_sdk/client/api/api_client/http/base_http_client.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import warnings
23
from typing import Optional, TypeVar, overload
34

45
import requests
@@ -9,6 +10,7 @@
910
from exabel_data_sdk.client.api.data_classes.request_error import RequestError
1011
from exabel_data_sdk.client.api.error_handler import http_status_to_error_type
1112
from exabel_data_sdk.client.client_config import ClientConfig
13+
from exabel_data_sdk.util.warnings import ExabelDeprecationWarning
1214

1315
TMessage = TypeVar("TMessage", bound=Message)
1416

@@ -35,6 +37,14 @@ def _request(self, method: str, url: str, response_proto: None, body: Message =
3537
def _request(
3638
self, method: str, url: str, response_proto: Optional[TMessage], body: Message = None
3739
) -> Optional[TMessage]:
40+
warnings.warn(
41+
"The HTTP/REST client is deprecated as of version 3.7.0 of the Exabel Python SDK. "
42+
"Support will be removed in a future release. Please run scripts without the "
43+
'"--use-json" flag, or instantiate the ExabelClient with use_json = False.',
44+
ExabelDeprecationWarning,
45+
stacklevel=2,
46+
)
47+
3848
response = requests.request(
3949
method,
4050
f"https://{self.host}/v1/{url}",

exabel_data_sdk/scripts/command_line_script.py

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def setup_logging(
2424
) -> None:
2525
"""Setup logging"""
2626
logging.basicConfig(format=format, level=level, stream=stream)
27+
logging.captureWarnings(True)
2728

2829
@abc.abstractmethod
2930
def run(self) -> None:

exabel_data_sdk/util/warnings.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ExabelDeprecationWarning(FutureWarning):
2+
"""Warning for deprecated features that will be removed or altered in the future."""

0 commit comments

Comments
 (0)