diff --git a/dune_client/api/custom.py b/dune_client/api/custom.py index bfd24ec..ce46060 100644 --- a/dune_client/api/custom.py +++ b/dune_client/api/custom.py @@ -5,6 +5,8 @@ from __future__ import annotations +from deprecated import deprecated + from dune_client.api.base import BaseRouter from dune_client.models import ( DuneError, @@ -19,6 +21,10 @@ class CustomEndpointAPI(BaseRouter): get_custom_endpoint_result(): returns the results of a custom endpoint. """ + @deprecated( + version="1.8.1", + reason="Custom endpoints feature is deprecated and will be removed in a future version", + ) def get_custom_endpoint_result( self, handle: str, diff --git a/tests/e2e/test_custom_endpoints.py b/tests/e2e/test_custom_endpoints.py index eb56a89..375dc33 100644 --- a/tests/e2e/test_custom_endpoints.py +++ b/tests/e2e/test_custom_endpoints.py @@ -1,5 +1,6 @@ import os import unittest +import warnings import dotenv @@ -15,8 +16,14 @@ def setUp(self) -> None: def test_getting_custom_endpoint_results(self): dune = DuneClient(self.valid_api_key) - results = dune.get_custom_endpoint_result("dune", "new-test") - assert len(results.get_rows()) == 10 + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + results = dune.get_custom_endpoint_result("dune", "new-test") + assert len(results.get_rows()) == 10 + # Verify that a deprecation warning was issued + assert len(w) == 1 + assert issubclass(w[0].category, DeprecationWarning) + assert "deprecated" in str(w[0].message).lower() if __name__ == "__main__":