Skip to content

Commit 27f7b6c

Browse files
authored
deprecate custom_endpoints (#172)
* deprecate custom_endpoints * fmt
1 parent 1ea7a7d commit 27f7b6c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

dune_client/api/custom.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from __future__ import annotations
77

8+
from deprecated import deprecated
9+
810
from dune_client.api.base import BaseRouter
911
from dune_client.models import (
1012
DuneError,
@@ -19,6 +21,10 @@ class CustomEndpointAPI(BaseRouter):
1921
get_custom_endpoint_result(): returns the results of a custom endpoint.
2022
"""
2123

24+
@deprecated(
25+
version="1.8.1",
26+
reason="Custom endpoints feature is deprecated and will be removed in a future version",
27+
)
2228
def get_custom_endpoint_result(
2329
self,
2430
handle: str,

tests/e2e/test_custom_endpoints.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import unittest
3+
import warnings
34

45
import dotenv
56

@@ -15,8 +16,14 @@ def setUp(self) -> None:
1516

1617
def test_getting_custom_endpoint_results(self):
1718
dune = DuneClient(self.valid_api_key)
18-
results = dune.get_custom_endpoint_result("dune", "new-test")
19-
assert len(results.get_rows()) == 10
19+
with warnings.catch_warnings(record=True) as w:
20+
warnings.simplefilter("always")
21+
results = dune.get_custom_endpoint_result("dune", "new-test")
22+
assert len(results.get_rows()) == 10
23+
# Verify that a deprecation warning was issued
24+
assert len(w) == 1
25+
assert issubclass(w[0].category, DeprecationWarning)
26+
assert "deprecated" in str(w[0].message).lower()
2027

2128

2229
if __name__ == "__main__":

0 commit comments

Comments
 (0)