From c3506253d7d49ea8711a8a93ffa06f32fd755360 Mon Sep 17 00:00:00 2001 From: Boris Fersing Date: Fri, 14 Nov 2025 13:29:46 -0500 Subject: [PATCH] Moved the platform host to const --- pyhilo/const.py | 1 + pyhilo/graphql.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyhilo/const.py b/pyhilo/const.py index 613c257..2143a98 100755 --- a/pyhilo/const.py +++ b/pyhilo/const.py @@ -32,6 +32,7 @@ API_NOTIFICATIONS_ENDPOINT: Final = "/Notifications" API_EVENTS_ENDPOINT: Final = "/Notifications" API_REGISTRATION_ENDPOINT: Final = f"{API_NOTIFICATIONS_ENDPOINT}/Registrations" +PLATFORM_HOST: Final = "platform.hiloenergie.com" API_REGISTRATION_HEADERS: Final = { "AppId": ANDROID_PKG_NAME, diff --git a/pyhilo/graphql.py b/pyhilo/graphql.py index 8c52ebb..548dd0d 100644 --- a/pyhilo/graphql.py +++ b/pyhilo/graphql.py @@ -8,7 +8,7 @@ from gql.transport.websockets import WebsocketsTransport from pyhilo import API -from pyhilo.const import LOG +from pyhilo.const import LOG, PLATFORM_HOST from pyhilo.device.graphql_value_mapper import GraphqlValueMapper from pyhilo.devices import Devices @@ -534,7 +534,7 @@ async def call_get_location_query(self, location_hilo_id: str) -> None: """This functions calls the digital-twin and requests location id""" access_token = await self._get_access_token() transport = AIOHTTPTransport( - url="https://platform.hiloenergie.com/api/digital-twin/v3/graphql", + url=f"https://{PLATFORM_HOST}/api/digital-twin/v3/graphql", headers={"Authorization": f"Bearer {access_token}"}, ) client = Client(transport=transport, fetch_schema_from_transport=True) @@ -562,7 +562,7 @@ async def subscribe_to_device_updated( LOG.debug("subscribe_to_device_updated while true") access_token = await self._get_access_token() transport = WebsocketsTransport( - url=f"wss://platform.hiloenergie.com/api/digital-twin/v3/graphql?access_token={access_token}", + url=f"wss://{PLATFORM_HOST}/api/digital-twin/v3/graphql?access_token={access_token}", ssl=ssl_context, ) client = Client(transport=transport, fetch_schema_from_transport=True) @@ -602,7 +602,7 @@ async def subscribe_to_location_updated( ) -> None: access_token = await self._get_access_token() transport = WebsocketsTransport( - url=f"wss://platform.hiloenergie.com/api/digital-twin/v3/graphql?access_token={access_token}" + url=f"wss://{PLATFORM_HOST}/api/digital-twin/v3/graphql?access_token={access_token}" ) client = Client(transport=transport, fetch_schema_from_transport=True) query = gql(self.SUBSCRIPTION_LOCATION_UPDATED)