Skip to content

Commit

Permalink
feat: add User-Agent to all requests (#34)
Browse files Browse the repository at this point in the history
* set user-agent to custom integration name

* fix load manifest file

* bump version
  • Loading branch information
duhow authored Nov 10, 2024
1 parent be80f6b commit 8a53222
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions custom_components/aigues_barcelona/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from .const import API_COOKIE_TOKEN
from .const import API_HOST
from .version import VERSION

TIMEOUT = 60

Expand All @@ -27,6 +28,7 @@ def __init__(
"Ocp-Apim-Subscription-Key": "3cca6060fee14bffa3450b19941bd954",
"Ocp-Apim-Trace": "false",
"Content-Type": "application/json; charset=UTF-8",
"User-Agent": f"hass-aigues-barcelona/{VERSION} (Home Assistant)",
}
self._username = username
self._password = password
Expand Down
2 changes: 1 addition & 1 deletion custom_components/aigues_barcelona/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/duhow/hass-aigues-barcelona/issues",
"requirements": [],
"version": "0.4.3"
"version": "0.4.4"
}
10 changes: 10 additions & 0 deletions custom_components/aigues_barcelona/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import json
import os

try:
with open(os.path.join(os.path.dirname(__file__), "manifest.json")) as f:
manifest = json.load(f)
except FileNotFoundError:
manifest = {}

VERSION = manifest.get("version", "0.0.0")

0 comments on commit 8a53222

Please sign in to comment.