Skip to content

Commit cb2bd98

Browse files
committed
Merge remote-tracking branch 'origin/main' into backport-200-to-8.17
2 parents ae4b7f0 + 6167370 commit cb2bd98

File tree

8 files changed

+41
-23
lines changed

8 files changed

+41
-23
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: Checkout repository
1111
uses: actions/checkout@v1
1212
- name: Set up Python 3.x
13-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1414
with:
1515
python-version: 3.x
1616
- name: Install dependencies
@@ -24,7 +24,7 @@ jobs:
2424
- name: Checkout Repository
2525
uses: actions/checkout@v1
2626
- name: Set up Python 3.x
27-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@v5
2828
with:
2929
python-version: 3.x
3030
- name: Install dependencies
@@ -40,7 +40,7 @@ jobs:
4040
strategy:
4141
fail-fast: false
4242
matrix:
43-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
43+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
4444
os: ["ubuntu-latest"]
4545
experimental: [false]
4646
nox-session: ['']
@@ -58,14 +58,10 @@ jobs:
5858
uses: actions/checkout@v2
5959

6060
- name: Set up Python - ${{ matrix.python-version }}
61-
uses: actions/setup-python@v2
61+
uses: actions/setup-python@v5
6262
with:
6363
python-version: ${{ matrix.python-version }}
64-
65-
- name: Set up Python 3.x to run nox
66-
uses: actions/setup-python@v2
67-
with:
68-
python-version: 3.x
64+
allow-prereleases: true
6965

7066
- name: Install Dependencies
7167
run: python -m pip install --upgrade nox

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 8.15.1 (2024-10-09)
4+
5+
* Add explicit Python 3.13 support ([#189](https://github.com/elastic/elastic-transport-python/pull/189))
6+
7+
## 8.15.0 (2024-08-09)
8+
9+
* Removed call to `raise_for_status()` when using `HttpxAsyncHttpNode` to prevent exceptions being raised for 404 responses ([#182](https://github.com/elastic/elastic-transport-python/pull/182))
10+
* Documented response classes ([#175](https://github.com/elastic/elastic-transport-python/pull/175))
11+
* Dropped support for Python 3.7 ([#179](https://github.com/elastic/elastic-transport-python/pull/179))
12+
313
## 8.13.1 (2024-04-28)
414

515
- Fixed requests 2.32 compatibility (#164)

elastic_transport/_node/_http_aiohttp.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import ssl
2525
import sys
2626
import warnings
27-
from typing import Optional, Union
27+
from typing import Optional, TypedDict, Union
2828

2929
from .._compat import warn_stacklevel
3030
from .._exceptions import ConnectionError, ConnectionTimeout, SecurityWarning, TlsError
@@ -56,6 +56,10 @@
5656

5757
# See aio-libs/aiohttp#1769 and #5012
5858
_AIOHTTP_FIXED_HEAD_BUG = _AIOHTTP_SEMVER_VERSION >= (3, 7, 0)
59+
60+
class RequestKwarg(TypedDict, total=False):
61+
ssl: aiohttp.Fingerprint
62+
5963
except ImportError: # pragma: nocover
6064
_AIOHTTP_AVAILABLE = False
6165
_AIOHTTP_META_VERSION = ""
@@ -176,7 +180,7 @@ async def perform_request( # type: ignore[override]
176180
else:
177181
body_to_send = None
178182

179-
kwargs = {}
183+
kwargs: RequestKwarg = {}
180184
if self._ssl_assert_fingerprint:
181185
kwargs["ssl"] = aiohttp_fingerprint(self._ssl_assert_fingerprint)
182186

elastic_transport/_node/_http_urllib3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def perform_request(
199199
body=body,
200200
exception=err,
201201
)
202-
raise err from None
202+
raise err from e
203203

204204
meta = ApiResponseMeta(
205205
node=self.config,

elastic_transport/_node/_urllib3_chain_certs.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,20 @@ def _validate_conn(self, conn: HTTPSConnection) -> None: # type: ignore[overrid
105105

106106
fingerprints: List[bytes]
107107
try:
108-
# 'get_verified_chain()' and 'Certificate.public_bytes()' are private APIs
109-
# in CPython 3.10. They're not documented anywhere yet but seem to work
110-
# and we need them for Security on by Default so... onwards we go!
111-
# See: https://github.com/python/cpython/pull/25467
112-
fingerprints = [
113-
hash_func(cert.public_bytes(_ENCODING_DER)).digest()
114-
for cert in conn.sock._sslobj.get_verified_chain() # type: ignore[union-attr]
115-
]
108+
if sys.version_info >= (3, 13):
109+
fingerprints = [
110+
hash_func(cert).digest()
111+
for cert in conn.sock.get_verified_chain()
112+
]
113+
else:
114+
# 'get_verified_chain()' and 'Certificate.public_bytes()' are private APIs
115+
# in CPython 3.10. They're not documented anywhere yet but seem to work
116+
# and we need them for Security on by Default so... onwards we go!
117+
# See: https://github.com/python/cpython/pull/25467
118+
fingerprints = [
119+
hash_func(cert.public_bytes(_ENCODING_DER)).digest()
120+
for cert in conn.sock._sslobj.get_verified_chain() # type: ignore[union-attr]
121+
]
116122
except RERAISE_EXCEPTIONS: # pragma: nocover
117123
raise
118124
# Because these are private APIs we are super careful here

elastic_transport/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
__version__ = "8.13.1"
18+
__version__ = "8.15.1"

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def lint(session):
5959
session.run("mypy", "--strict", "--show-error-codes", "elastic_transport/")
6060

6161

62-
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
62+
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"])
6363
def test(session):
6464
session.install(".[develop]")
6565
session.run(

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
install_requires=[
5353
"urllib3>=1.26.2, <3",
5454
"certifi",
55-
"importlib-metadata; python_version<'3.8'",
5655
],
5756
python_requires=">=3.8",
5857
extras_require={
@@ -66,6 +65,8 @@
6665
"requests",
6766
"aiohttp",
6867
"httpx",
68+
# https://github.com/encode/httpx/discussions/3214#discussioncomment-10830925
69+
"httpcore<1.0.6",
6970
"respx",
7071
"opentelemetry-api",
7172
"opentelemetry-sdk",
@@ -88,6 +89,7 @@
8889
"Programming Language :: Python :: 3.10",
8990
"Programming Language :: Python :: 3.11",
9091
"Programming Language :: Python :: 3.12",
92+
"Programming Language :: Python :: 3.13",
9193
"Programming Language :: Python :: Implementation :: CPython",
9294
"Programming Language :: Python :: Implementation :: PyPy",
9395
],

0 commit comments

Comments
 (0)