Skip to content

Commit

Permalink
Add optional API URL to connect functions (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
fustom authored May 21, 2024
1 parent a21c6ae commit 6f01404
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ariston/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def _get_device(
return None


def _connect(username: str, password: str) -> AristonAPI:
def _connect(username: str, password: str, api_url: str = ARISTON_API_URL) -> AristonAPI:
"""Connect to ariston api"""
api = AristonAPI(username, password)
api = AristonAPI(username, password, api_url)
api.connect()
return api

Expand Down Expand Up @@ -149,9 +149,9 @@ def hello(
return _get_device(cloud_devices, api, gateway, is_metric, language_tag)


async def _async_connect(username: str, password: str) -> AristonAPI:
async def _async_connect(username: str, password: str, api_url: str = ARISTON_API_URL) -> AristonAPI:
"""Async connect to ariston api"""
api = AristonAPI(username, password)
api = AristonAPI(username, password, api_url)
if not await api.async_connect():
raise ConnectionException
return api
Expand Down

0 comments on commit 6f01404

Please sign in to comment.