Control: tags 1099272 + patch
Control: tags 1099272 + pending

Dear maintainer,

I've prepared an NMU for python-bimmer-connected (versioned as 
0.16.3-1.2) and uploaded it to DELAYED/14. Please feel free to
tell me if I should cancel it.

cu
Adrian
diffstat for python-bimmer-connected-0.16.3 python-bimmer-connected-0.16.3

 changelog                                   |    7 +
 patches/0001-Fix-for-httpx-0.28.0-693.patch |  140 ++++++++++++++++++++++++++++
 patches/series                              |    1 
 3 files changed, 148 insertions(+)

diff -Nru python-bimmer-connected-0.16.3/debian/changelog python-bimmer-connected-0.16.3/debian/changelog
--- python-bimmer-connected-0.16.3/debian/changelog	2024-11-23 15:28:06.000000000 +0200
+++ python-bimmer-connected-0.16.3/debian/changelog	2025-04-11 19:32:38.000000000 +0300
@@ -1,3 +1,10 @@
+python-bimmer-connected (0.16.3-1.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Backport upstream fix for HTTPX 0.28. (Closes: #1099272)
+
+ -- Adrian Bunk <b...@debian.org>  Fri, 11 Apr 2025 19:32:38 +0300
+
 python-bimmer-connected (0.16.3-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru python-bimmer-connected-0.16.3/debian/patches/0001-Fix-for-httpx-0.28.0-693.patch python-bimmer-connected-0.16.3/debian/patches/0001-Fix-for-httpx-0.28.0-693.patch
--- python-bimmer-connected-0.16.3/debian/patches/0001-Fix-for-httpx-0.28.0-693.patch	1970-01-01 02:00:00.000000000 +0200
+++ python-bimmer-connected-0.16.3/debian/patches/0001-Fix-for-httpx-0.28.0-693.patch	2025-04-11 19:15:02.000000000 +0300
@@ -0,0 +1,140 @@
+From 05b6d94b2b12630a7e0728e5d57d1e642c989826 Mon Sep 17 00:00:00 2001
+From: Richard Kroegel <42204099+rik...@users.noreply.github.com>
+Date: Fri, 29 Nov 2024 22:16:12 +0100
+Subject: Fix for httpx>=0.28.0 (#693)
+
+* Improve docs documentation
+
+* Fix for httpx>=0.28.0
+
+* Temporary fix for respx not supporting httpx>=0.28.0
+
+* Revert "Improve docs documentation"
+
+This reverts commit d88948774bd568296bb4c246a455fd38d85d495a.
+
+* Fix typing
+---
+ bimmer_connected/account.py            | 7 +++----
+ bimmer_connected/api/authentication.py | 7 ++++---
+ bimmer_connected/api/client.py         | 5 +++--
+ bimmer_connected/tests/common.py       | 3 +++
+ bimmer_connected/tests/test_cli.py     | 4 +++-
+ 5 files changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/bimmer_connected/account.py b/bimmer_connected/account.py
+index a107613..197dfdd 100644
+--- a/bimmer_connected/account.py
++++ b/bimmer_connected/account.py
+@@ -3,10 +3,9 @@
+ import datetime
+ import json
+ import logging
++import ssl
+ from dataclasses import InitVar, dataclass, field
+-from typing import List, Optional
+-
+-import httpx
++from typing import List, Optional, Union
+ 
+ from bimmer_connected.api.authentication import MyBMWAuthentication
+ from bimmer_connected.api.client import RESPONSE_STORE, MyBMWClient, MyBMWClientConfiguration
+@@ -47,7 +46,7 @@ class MyBMWAccount:
+     observer_position: InitVar[GPSPosition] = None
+     """Optional. Required for getting a position on older cars."""
+ 
+-    verify: InitVar[httpx._types.VerifyTypes] = True
++    verify: InitVar[Union[ssl.SSLContext, str, bool]] = True
+     """Optional. Specify SSL context (required for Home Assistant)."""
+ 
+     use_metric_units: InitVar[Optional[bool]] = None
+diff --git a/bimmer_connected/api/authentication.py b/bimmer_connected/api/authentication.py
+index f77a240..d1473f6 100644
+--- a/bimmer_connected/api/authentication.py
++++ b/bimmer_connected/api/authentication.py
+@@ -5,8 +5,9 @@ import base64
+ import datetime
+ import logging
+ import math
++import ssl
+ from collections import defaultdict
+-from typing import AsyncGenerator, Generator, Optional
++from typing import AsyncGenerator, Generator, Optional, Union
+ from uuid import uuid4
+ 
+ import httpx
+@@ -53,7 +54,7 @@ class MyBMWAuthentication(httpx.Auth):
+         expires_at: Optional[datetime.datetime] = None,
+         refresh_token: Optional[str] = None,
+         gcid: Optional[str] = None,
+-        verify: httpx._types.VerifyTypes = True,
++        verify: Union[ssl.SSLContext, str, bool] = True,
+     ):
+         self.username: str = username
+         self.password: str = password
+@@ -66,7 +67,7 @@ class MyBMWAuthentication(httpx.Auth):
+         self.gcid: Optional[str] = gcid
+         # Use external SSL context. Required in Home Assistant due to event loop blocking when httpx loads
+         # SSL certificates from disk. If not given, uses httpx defaults.
+-        self.verify: Optional[httpx._types.VerifyTypes] = verify
++        self.verify: Union[ssl.SSLContext, str, bool] = verify
+ 
+     @property
+     def login_lock(self) -> asyncio.Lock:
+diff --git a/bimmer_connected/api/client.py b/bimmer_connected/api/client.py
+index a29f60f..b11891b 100644
+--- a/bimmer_connected/api/client.py
++++ b/bimmer_connected/api/client.py
+@@ -1,9 +1,10 @@
+ """Generic API management."""
+ 
+ import logging
++import ssl
+ from collections import defaultdict, deque
+ from dataclasses import dataclass
+-from typing import Deque, Dict, Optional
++from typing import Deque, Dict, Optional, Union
+ 
+ import httpx
+ 
+@@ -25,7 +26,7 @@ class MyBMWClientConfiguration:
+     authentication: MyBMWAuthentication
+     log_responses: Optional[bool] = False
+     observer_position: Optional[GPSPosition] = None
+-    verify: httpx._types.VerifyTypes = True
++    verify: Union[ssl.SSLContext, str, bool] = True
+ 
+     def set_log_responses(self, log_responses: bool) -> None:
+         """Set if responses are logged and clear response store."""
+diff --git a/bimmer_connected/tests/common.py b/bimmer_connected/tests/common.py
+index d4e32a6..5d4a774 100644
+--- a/bimmer_connected/tests/common.py
++++ b/bimmer_connected/tests/common.py
+@@ -58,6 +58,9 @@ LOCAL_CHARGING_SETTINGS: Dict[str, Dict] = {}
+ class MyBMWMockRouter(respx.MockRouter):
+     """Stateful MockRouter for MyBMW APIs."""
+ 
++    # See https://github.com/lundberg/respx/issues/277#issuecomment-2507693706
++    using = "httpx"
++
+     def __init__(
+         self,
+         vehicles_to_load: Optional[List[str]] = None,
+diff --git a/bimmer_connected/tests/test_cli.py b/bimmer_connected/tests/test_cli.py
+index 4ac4850..9d0ed31 100644
+--- a/bimmer_connected/tests/test_cli.py
++++ b/bimmer_connected/tests/test_cli.py
+@@ -262,7 +262,9 @@ def test_login_refresh_token(cli_home_dir: Path, bmw_fixture: respx.Router):
+     bimmer_connected.cli.main()
+ 
+     assert bmw_fixture.routes["token"].call_count == 1
+-    assert bmw_fixture.routes["vehicles"].calls[0].request.headers["authorization"] == "Bearer outdated_access_token"
++    # TODO: The following doesn't work with MyBMWMockRouter.using = "httpx"
++    # Need to wait for a respx update supporting httpx>=0.28.0 natively
++    # assert bmw_fixture.routes["vehicles"].calls[0].request.headers["authorization"] == "Bearer outdated_access_token"
+     assert bmw_fixture.routes["vehicles"].calls.last.request.headers["authorization"] == "Bearer some_token_string"
+ 
+     assert (cli_home_dir / ".bimmer_connected.json").exists() is True
+-- 
+2.30.2
+
diff -Nru python-bimmer-connected-0.16.3/debian/patches/series python-bimmer-connected-0.16.3/debian/patches/series
--- python-bimmer-connected-0.16.3/debian/patches/series	2024-11-23 15:28:02.000000000 +0200
+++ python-bimmer-connected-0.16.3/debian/patches/series	2025-04-11 19:32:38.000000000 +0300
@@ -1,3 +1,4 @@
 fix-import-cryptodome.patch
 install-missing-files.patch
 use-python3-not-python.patch
+0001-Fix-for-httpx-0.28.0-693.patch

Reply via email to