From 35bc326267415710fd1d3a4b28efe0bc4e07c8f3 Mon Sep 17 00:00:00 2001 From: Jules Dejaeghere Date: Mon, 20 May 2024 10:54:42 +0200 Subject: [PATCH] Add User-Agent to the client --- custom_components/irm_kmi/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/custom_components/irm_kmi/api.py b/custom_components/irm_kmi/api.py index a106fd7..44e53af 100644 --- a/custom_components/irm_kmi/api.py +++ b/custom_components/irm_kmi/api.py @@ -69,6 +69,10 @@ class IrmKmiApiClient: headers: dict | None = None, ) -> any: """Get information from the API.""" + if headers is None: + headers = {'User-Agent': 'github.com/jdejaegh/irm-kmi-ha'} + else: + headers['User-Agent'] = 'github.com/jdejaegh/irm-kmi-ha' try: async with async_timeout.timeout(60):