diff --git a/.pylintrc b/.pylintrc index 7130db2..0f486f9 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,4 +1,4 @@ [MASTER] -disable=fixme,logging-fstring-interpolation +disable=fixme,logging-fstring-interpolation,too-many-positional-arguments [DESIGN] max-args=10 diff --git a/Makefile b/Makefile index 1679f9c..17859e0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VENV = venv +VENV = .venv PYTHON = $(VENV)/bin/python3 PIP = $(VENV)/bin/pip diff --git a/dune_client/client_async.py b/dune_client/client_async.py index 2db989e..39e24fa 100644 --- a/dune_client/client_async.py +++ b/dune_client/client_async.py @@ -7,9 +7,11 @@ from __future__ import annotations import asyncio +import ssl from io import BytesIO from typing import Any, Callable, Dict, List, Optional, Union +import certifi from aiohttp import ( ClientResponseError, ClientSession, @@ -83,7 +85,10 @@ def __init__( self._session: Optional[ClientSession] = None async def _create_session(self) -> ClientSession: - conn = TCPConnector(limit=self._connection_limit) + # Create an SSL context using the certifi certificate store + ssl_context = ssl.create_default_context(cafile=certifi.where()) + + conn = TCPConnector(limit=self._connection_limit, ssl=ssl_context) return ClientSession( connector=conn, base_url=self.base_url, diff --git a/dune_client/models.py b/dune_client/models.py index 15c96ff..b975edb 100644 --- a/dune_client/models.py +++ b/dune_client/models.py @@ -188,6 +188,7 @@ class ResultMetadata: # pylint: disable=too-many-instance-attributes column_names: list[str] + column_types: list[str] row_count: int result_set_bytes: int total_row_count: int @@ -203,6 +204,7 @@ def from_dict(cls, data: dict[str, Any]) -> ResultMetadata: pending_time = data.get("pending_time_millis", None) return cls( column_names=data["column_names"], + column_types=data["column_types"], row_count=int(data["total_row_count"]), result_set_bytes=int(data["result_set_bytes"]), total_row_count=int(data["total_row_count"]), diff --git a/tests/e2e/test_custom_endpoints.py b/tests/e2e/test_custom_endpoints.py index 2f12d45..68e6282 100644 --- a/tests/e2e/test_custom_endpoints.py +++ b/tests/e2e/test_custom_endpoints.py @@ -10,11 +10,12 @@ dotenv.load_dotenv() +@unittest.skip("endpoint no longer exists - {'error': 'Custom endpoint not found'}") class TestCustomEndpoints(unittest.TestCase): def setUp(self) -> None: self.valid_api_key = os.environ["DUNE_API_KEY"] - def test_gettin_custom_endpoint_results(self): + def test_getting_custom_endpoint_results(self): dune = DuneClient(self.valid_api_key) results = dune.get_custom_endpoint_result("dune", "new-test") self.assertEqual(len(results.get_rows()), 10) diff --git a/tests/unit/test_models.py b/tests/unit/test_models.py index 856571d..882dfee 100644 --- a/tests/unit/test_models.py +++ b/tests/unit/test_models.py @@ -44,6 +44,7 @@ def setUp(self) -> None: } self.result_metadata_data = { "column_names": ["ct", "TableName"], + "column_types": ["x", "y"], "row_count": 8, "result_set_bytes": 194, "total_result_set_bytes": 194, @@ -143,6 +144,7 @@ def test_parse_known_status_response(self): "execution_ended_at": "2022-10-07T10:53:20.729372559Z", "result_metadata": { "column_names": ["token"], + "column_types": ["varchar"], "result_set_bytes": 815, "total_row_count": 18, "datapoint_count": 18, @@ -171,6 +173,7 @@ def test_parse_status_response_completed(self): def test_parse_result_metadata(self): expected = ResultMetadata( column_names=["ct", "TableName"], + column_types=["x", "y"], row_count=8, result_set_bytes=194, total_row_count=8,