Skip to content

Commit c350625

Browse files
author
Boris Fersing
committed
Moved the platform host to const
1 parent 9472cfb commit c350625

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pyhilo/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
API_NOTIFICATIONS_ENDPOINT: Final = "/Notifications"
3333
API_EVENTS_ENDPOINT: Final = "/Notifications"
3434
API_REGISTRATION_ENDPOINT: Final = f"{API_NOTIFICATIONS_ENDPOINT}/Registrations"
35+
PLATFORM_HOST: Final = "platform.hiloenergie.com"
3536

3637
API_REGISTRATION_HEADERS: Final = {
3738
"AppId": ANDROID_PKG_NAME,

pyhilo/graphql.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from gql.transport.websockets import WebsocketsTransport
99

1010
from pyhilo import API
11-
from pyhilo.const import LOG
11+
from pyhilo.const import LOG, PLATFORM_HOST
1212
from pyhilo.device.graphql_value_mapper import GraphqlValueMapper
1313
from pyhilo.devices import Devices
1414

@@ -534,7 +534,7 @@ async def call_get_location_query(self, location_hilo_id: str) -> None:
534534
"""This functions calls the digital-twin and requests location id"""
535535
access_token = await self._get_access_token()
536536
transport = AIOHTTPTransport(
537-
url="https://platform.hiloenergie.com/api/digital-twin/v3/graphql",
537+
url=f"https://{PLATFORM_HOST}/api/digital-twin/v3/graphql",
538538
headers={"Authorization": f"Bearer {access_token}"},
539539
)
540540
client = Client(transport=transport, fetch_schema_from_transport=True)
@@ -562,7 +562,7 @@ async def subscribe_to_device_updated(
562562
LOG.debug("subscribe_to_device_updated while true")
563563
access_token = await self._get_access_token()
564564
transport = WebsocketsTransport(
565-
url=f"wss://platform.hiloenergie.com/api/digital-twin/v3/graphql?access_token={access_token}",
565+
url=f"wss://{PLATFORM_HOST}/api/digital-twin/v3/graphql?access_token={access_token}",
566566
ssl=ssl_context,
567567
)
568568
client = Client(transport=transport, fetch_schema_from_transport=True)
@@ -602,7 +602,7 @@ async def subscribe_to_location_updated(
602602
) -> None:
603603
access_token = await self._get_access_token()
604604
transport = WebsocketsTransport(
605-
url=f"wss://platform.hiloenergie.com/api/digital-twin/v3/graphql?access_token={access_token}"
605+
url=f"wss://{PLATFORM_HOST}/api/digital-twin/v3/graphql?access_token={access_token}"
606606
)
607607
client = Client(transport=transport, fetch_schema_from_transport=True)
608608
query = gql(self.SUBSCRIPTION_LOCATION_UPDATED)

0 commit comments

Comments
 (0)