Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
alekslyse committed Apr 18, 2019
1 parent fbcee2c commit eb86322
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ginlong/ginlong.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,21 @@ def __init__(self, plant_id, parent):
self.name = None
self.current_production = None
self.token = parent._test
self._parent = parent

async def authenticate(self, username, password):
"""Authenticate."""
try:
async with async_timeout.timeout(5, loop=self._parent.self._loop):
params = {'user_id': username, 'user_pass': password}
response = await self._parent._session.get(self._parent.self.base_url+'/cust/user/login', params=params)


print(response)
except (asyncio.TimeoutError, aiohttp.ClientError, socket.gaierror):
_LOGGER.error("Can not load data from Ginlong API")
raise exceptions.GinlongConnectionError

@property
async def get_name(self):
"""Return all plants."""
Expand Down

0 comments on commit eb86322

Please sign in to comment.