platform login is working
This commit is contained in:
parent
44a04f451e
commit
93bd81ecea
8 changed files with 174 additions and 32 deletions
|
@ -1,7 +1,7 @@
|
|||
import asyncio
|
||||
import logging
|
||||
|
||||
from aiohttp import ClientResponse
|
||||
from aiohttp import ClientSession
|
||||
|
||||
from resa_padel import config
|
||||
from resa_padel.gestion_sports_connector import GestionSportsConnector
|
||||
|
@ -9,13 +9,17 @@ from resa_padel.gestion_sports_connector import GestionSportsConnector
|
|||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def connect(url: str) -> ClientResponse:
|
||||
booking_platform = GestionSportsConnector(url)
|
||||
return await booking_platform.connect()
|
||||
async def book(url: str, user: str, password: str, club_id: str) -> ClientSession:
|
||||
async with ClientSession() as session:
|
||||
platform = GestionSportsConnector(session, url)
|
||||
await platform.connect()
|
||||
await platform.login(user, password, club_id)
|
||||
return session
|
||||
|
||||
|
||||
def main() -> ClientResponse:
|
||||
def main() -> None:
|
||||
LOGGER.info("Starting booking padel court")
|
||||
response = asyncio.run(connect(config.GESTION_SPORTS_URL))
|
||||
asyncio.run(
|
||||
book(config.GESTION_SPORTS_URL, config.USER, config.PASSWORD, config.CLUB_ID)
|
||||
)
|
||||
LOGGER.info("Finished booking padel court")
|
||||
return response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue