Skip to content

Commit

Permalink
Merge pull request #314 from EvanBldy/bot
Browse files Browse the repository at this point in the history
[bot] add new function set_token
  • Loading branch information
frankrousseau authored Feb 17, 2024
2 parents 85f9e02 + 14a02f7 commit d707956
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions gazu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,18 @@ def get_event_host(client=raw.default_client):

def set_event_host(url, client=raw.default_client):
raw.set_event_host(url, client=client)


def set_token(token, client=raw.default_client):
"""
Store authentication token to reuse them for all requests.
Args:
new_tokens (dict): Tokens to use for authentication.
"""
tokens = {}
if isinstance(token, dict):
tokens["access_token"] = token["access_token"]
else:
tokens["access_token"] = token
return raw.set_tokens(tokens, client=client)
7 changes: 7 additions & 0 deletions gazu/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def new_person(
desktop_login="",
departments=[],
password=None,
is_bot=False,
expiration_date=None,
client=default,
):
"""
Expand All @@ -208,6 +210,9 @@ def new_person(
and studio manager)
desktop_login (str): The login the users uses to log on its computer.
departments (list): The departments for the person.
password (str): The password for the person.
is_bot (bool): Whether the person is a bot or not.
expiration_date (str): The expiration date for the person.
Returns:
dict: Created person.
"""
Expand All @@ -224,6 +229,8 @@ def new_person(
"desktop_login": desktop_login,
"departments": normalize_list_of_models_for_links(departments),
"password": password,
"is_bot": is_bot,
"expiration_date": expiration_date,
},
client=client,
)
Expand Down

0 comments on commit d707956

Please sign in to comment.