25 lines
726 B
Python
25 lines
726 B
Python
import asyncio
|
|
import logging
|
|
|
|
from aiohttp import ClientSession
|
|
|
|
from resa_padel import config
|
|
from resa_padel.gestion_sports_connector import GestionSportsConnector
|
|
|
|
LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
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() -> None:
|
|
LOGGER.info("Starting booking padel court")
|
|
asyncio.run(
|
|
book(config.GESTION_SPORTS_URL, config.USER, config.PASSWORD, config.CLUB_ID)
|
|
)
|
|
LOGGER.info("Finished booking padel court")
|