From cd897a3001a8e8cdea30212236705ed6294c5c18 Mon Sep 17 00:00:00 2001 From: Thomas <299636+heldchen@users.noreply.github.com> Date: Wed, 26 Jun 2024 18:07:00 +0200 Subject: [PATCH] Realign accsmart.panasonic.com headers with v1.21.0 In the Android App v1.21.0, requests headers are now all lowercase --- .../pcomfortcloud/panasonicrequestheader.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/custom_components/panasonic_cc/pcomfortcloud/panasonicrequestheader.py b/custom_components/panasonic_cc/pcomfortcloud/panasonicrequestheader.py index b2804a8..c5d38da 100644 --- a/custom_components/panasonic_cc/pcomfortcloud/panasonicrequestheader.py +++ b/custom_components/panasonic_cc/pcomfortcloud/panasonicrequestheader.py @@ -12,19 +12,19 @@ async def get(settings: PanasonicSettings, app_version: CCAppVersion, include_cl now = datetime.datetime.now() timestamp = now.strftime("%Y-%m-%d %H:%M:%S") headers={ - "Content-Type": "application/json;charset=utf-8", - "User-Agent": "G-RAC", - "X-APP-NAME": "Comfort Cloud", - "X-APP-TIMESTAMP": timestamp, - "X-APP-TYPE": "1", - "X-APP-VERSION": await app_version.get(), - "X-CFC-API-KEY": PanasonicRequestHeader._get_api_key(), - "X-User-Authorization-V2": "Bearer " + settings.access_token + "content-type": "application/json;charset=utf-8", + "user-agent": "G-RAC", + "x-app-name": "Comfort Cloud", + "x-app-timestamp": timestamp, + "x-app-type": "1", + "x-app-version": await app_version.get(), + "x-cfc-api-key": PanasonicRequestHeader._get_api_key(), + "x-user-authorization-v2": "Bearer " + settings.access_token } if (include_client_id and settings.clientId): - headers["X-Client-Id"] = settings.clientId + headers["x-client-id"] = settings.clientId return headers @staticmethod def _get_api_key(): - return ''.join(random.choice(string.hexdigits) for _ in range(128)) \ No newline at end of file + return ''.join(random.choice(string.hexdigits) for _ in range(128))