diff --git a/custom_components/trias/trias_client/client.py b/custom_components/trias/trias_client/client.py index 591ad95..72d877a 100644 --- a/custom_components/trias/trias_client/client.py +++ b/custom_components/trias/trias_client/client.py @@ -54,10 +54,17 @@ def get(self, payload): xml = header.replace("PAYLOAD__", payload) xml = xml.replace("NOW__", convert_to_zulu_format()) - req = requests.post( + headers = { + "Content-Type": "text/xml", + "User-Agent": "Wget/1.21.1 (linux-gnu)", + } + + req = requests.request( + "post", self.url, - data=xml, - headers={"Content-Type": "application/xml"}, + data=xml.encode("utf-8"), + headers=headers, + timeout=10, ) req.encoding = "utf-8" diff --git a/custom_components/trias/trias_client/exceptions.py b/custom_components/trias/trias_client/exceptions.py index 2aaa009..748e8c5 100644 --- a/custom_components/trias/trias_client/exceptions.py +++ b/custom_components/trias/trias_client/exceptions.py @@ -17,7 +17,6 @@ class ApiError(Exception): class InvalidLocationName(Exception): pass - class HttpError(Exception): def __init__(self, status_code, response, *args: object) -> None: super().__init__(*args)