diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb4a45ac..10de9256 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v1 - name: Set up Python 3.x - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.x - name: Install dependencies @@ -24,7 +24,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v1 - name: Set up Python 3.x - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.x - name: Install dependencies @@ -40,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] os: ["ubuntu-latest"] experimental: [false] nox-session: [''] @@ -58,14 +58,10 @@ jobs: uses: actions/checkout@v2 - name: Set up Python - ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - - name: Set up Python 3.x to run nox - uses: actions/setup-python@v2 - with: - python-version: 3.x + allow-prereleases: true - name: Install Dependencies run: python -m pip install --upgrade nox diff --git a/elastic_transport/_node/_http_aiohttp.py b/elastic_transport/_node/_http_aiohttp.py index 79dbf820..b75aa868 100644 --- a/elastic_transport/_node/_http_aiohttp.py +++ b/elastic_transport/_node/_http_aiohttp.py @@ -182,7 +182,7 @@ async def perform_request( # type: ignore[override] data=body_to_send, headers=request_headers, timeout=aiohttp_timeout, - **kwargs, + **kwargs, # type: ignore[arg-type] ) as response: if is_head: # We actually called 'GET' so throw away the data. await response.release() diff --git a/elastic_transport/_node/_http_urllib3.py b/elastic_transport/_node/_http_urllib3.py index f9b46094..45514ae5 100644 --- a/elastic_transport/_node/_http_urllib3.py +++ b/elastic_transport/_node/_http_urllib3.py @@ -199,7 +199,7 @@ def perform_request( body=body, exception=err, ) - raise err from None + raise err from e meta = ApiResponseMeta( node=self.config, diff --git a/elastic_transport/_node/_urllib3_chain_certs.py b/elastic_transport/_node/_urllib3_chain_certs.py index 30790eb6..e36449b6 100644 --- a/elastic_transport/_node/_urllib3_chain_certs.py +++ b/elastic_transport/_node/_urllib3_chain_certs.py @@ -105,14 +105,20 @@ def _validate_conn(self, conn: HTTPSConnection) -> None: # type: ignore[overrid fingerprints: List[bytes] try: - # 'get_verified_chain()' and 'Certificate.public_bytes()' are private APIs - # in CPython 3.10. They're not documented anywhere yet but seem to work - # and we need them for Security on by Default so... onwards we go! - # See: https://github.com/python/cpython/pull/25467 - fingerprints = [ - hash_func(cert.public_bytes(_ENCODING_DER)).digest() - for cert in conn.sock._sslobj.get_verified_chain() # type: ignore[union-attr] - ] + if sys.version_info >= (3, 13): + fingerprints = [ + hash_func(cert).digest() + for cert in conn.sock.get_verified_chain() + ] + else: + # 'get_verified_chain()' and 'Certificate.public_bytes()' are private APIs + # in CPython 3.10. They're not documented anywhere yet but seem to work + # and we need them for Security on by Default so... onwards we go! + # See: https://github.com/python/cpython/pull/25467 + fingerprints = [ + hash_func(cert.public_bytes(_ENCODING_DER)).digest() + for cert in conn.sock._sslobj.get_verified_chain() # type: ignore[union-attr] + ] except RERAISE_EXCEPTIONS: # pragma: nocover raise # Because these are private APIs we are super careful here diff --git a/noxfile.py b/noxfile.py index 4d8a11b4..141cae4b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -59,7 +59,7 @@ def lint(session): session.run("mypy", "--strict", "--show-error-codes", "elastic_transport/") -@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"]) +@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]) def test(session): session.install(".[develop]") session.run( diff --git a/setup.py b/setup.py index f55392e3..2e10c4f8 100644 --- a/setup.py +++ b/setup.py @@ -88,6 +88,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ],