Add User-Agent to the client

This commit is contained in:
Jules 2024-05-20 10:54:42 +02:00
parent e4a6d254af
commit 35bc326267
Signed by: jdejaegh
GPG key ID: 99D6D184CA66933A

View file

@ -69,6 +69,10 @@ class IrmKmiApiClient:
headers: dict | None = None, headers: dict | None = None,
) -> any: ) -> any:
"""Get information from the API.""" """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: try:
async with async_timeout.timeout(60): async with async_timeout.timeout(60):