platform login is working

This commit is contained in:
Stanislas Jouffroy 2024-02-11 19:44:02 +01:00
parent 44a04f451e
commit 93bd81ecea
8 changed files with 174 additions and 32 deletions

View file

@ -0,0 +1,33 @@
from resa_padel.exceptions import ArgumentMissing
class GestionSportsPayloadBuilder:
def __init__(self):
self._login = None
self._password = None
self._club_id = None
def login(self, login):
self._login = login
return self
def password(self, password):
self._password = password
return self
def club_id(self, club_id):
self._club_id = club_id
return self
def build_login_payload(self):
if self._login is None:
raise ArgumentMissing("Login not provided")
if self.password is None:
raise ArgumentMissing("Password not provided")
if self.club_id is None:
raise ArgumentMissing("Club ID not provided")
return (
f"ajax=connexionUser&id_club={self._club_id}&email={self._login}&form_ajax=1&pass={self._password}&compte"
f"=user&playeridonesignal=0&identifiant=identifiant&externCo=true"
).encode("utf-8")