utils¶
- class pyZUnivers.utils.Checker¶
Represents a checker object with boolean properties.
- journa¶
Indicates if the journa property is True or False.
- Type:
bool
- bonus¶
Indicates if the bonus property is True or False.
- Type:
bool
- advent¶
Indicates if the advent property is True or False.
- Type:
bool
- exception pyZUnivers.utils.ZUniversAPIError(url)¶
- pyZUnivers.utils.best_inventory(username: str, limit: int = 10) List[UserInventoryObject] ¶
Retrieves the best inventory items for a given username.
- Parameters:
username (str) – The username for which to retrieve the inventory.
limit (int, optional) – The maximum number of items to return. Defaults to 10.
- Returns:
A list of the best inventory items, sorted by score.
- Return type:
List[UserInventoryObject]
- pyZUnivers.utils.get_ascension_leaderboard(*usernames: str)¶
Retrieves the ascension leaderboard for the given usernames.
- Parameters:
*usernames (str) – Variable number of usernames to retrieve the leaderboard for.
- Returns:
A sorted list of users in the ascension leaderboard, sorted by maxFloorIndex and towerLogCount.
- Return type:
list
- pyZUnivers.utils.get_correct_datetime_format(date: str) str ¶
Checks if the given date string is in the format %Y-%m-%dT%H:%M:%S.%f or %Y-%m-%dT%H:%M:%S.
- Parameters:
date (str) – The date string to be checked.
- Returns:
The appropriate datetime format string based on the presence of milliseconds.
- Return type:
str
- pyZUnivers.utils.get_datas(url) List | Dict ¶
Fetches data from the specified URL and returns it as a list or dictionary.
- Parameters:
url (str) – The URL to fetch data from.
- Returns:
The fetched data as a list or dictionary.
- Return type:
Union[List, Dict]
- Raises:
ZUniversAPIError – If there is an error decoding the JSON response.
- pyZUnivers.utils.get_inventory(username: str, search: str = None) List[UserInventoryObject] ¶
Retrieve the inventory of a user.
- Parameters:
username (str) – The username of the user.
search (str, optional) – The search query to filter the inventory. Defaults to None.
- Returns:
A list of UserInventoryObject representing the user’s inventory.
- Return type:
List[UserInventoryObject]
- pyZUnivers.utils.is_advent_calendar() bool ¶
Check if the current date is within the Advent calendar period.
- Returns:
True if the current date is between December 1st and December 25th (inclusive), False otherwise.
- Return type:
bool
- pyZUnivers.utils.parse_username(username: str) tuple[str, str] ¶
Parses the given username and returns a tuple containing the original username and the parsed name.
- Parameters:
username (str) – The username to be parsed.
- Returns:
A tuple containing the original username and the parsed name.
- Return type:
tuple[str, str]
- pyZUnivers.utils.post_datas(url) List | Dict ¶
Sends a POST request to the specified URL and returns the response data.
- Parameters:
url (str) – The URL to send the POST request to.
- Returns:
The response data as a list or dictionary.
- Return type:
Union[List, Dict]
- Raises:
ZUniversAPIError – If there is an error decoding the response data as JSON.
Exception – If there is any other exception during the request.