added available users in config
This commit is contained in:
parent
52b962c709
commit
d0a0072b6d
2 changed files with 93 additions and 0 deletions
|
@ -64,6 +64,25 @@ def get_user() -> User:
|
|||
return User(login=login, password=password)
|
||||
|
||||
|
||||
def get_available_users() -> list[User]:
|
||||
"""
|
||||
Read the environment variables to get all the available users in order
|
||||
to increase the chance of having a user with a free slot for a booking
|
||||
|
||||
:return: the list of all users that can book a court
|
||||
"""
|
||||
available_users_credentials = os.environ.get("AVAILABLE_USERS_CREDENTIALS")
|
||||
available_users = [
|
||||
credential for credential in available_users_credentials.split(",")
|
||||
]
|
||||
users = []
|
||||
for user in available_users:
|
||||
login, password = user.split(":")
|
||||
users.append(User(login=login, password=password))
|
||||
|
||||
return users
|
||||
|
||||
|
||||
def get_post_headers(platform_id: str) -> dict:
|
||||
"""
|
||||
Get the headers for the POST endpoint related to a specific booking platform
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue