utils package
Submodules
utils.common_types module
Types used for clearer documentation and type hinting
utils.config module
utils.errors module
- exception utils.errors.ApiTokenMissingError[source]
Bases:
ExceptionRaised when API key is not provided.
- exception utils.errors.BaseUrlMissingError[source]
Bases:
ExceptionRaised when base url is not provided.
- exception utils.errors.ForbiddenError[source]
Bases:
ExceptionRaised when a forbidden request is made
- exception utils.errors.IncompatibleDictionarySchema[source]
Bases:
ExceptionRaised when a dictionary cannot be unnested.
- exception utils.errors.InternalServerError[source]
Bases:
ExceptionRaised when an internal server error occurs
- exception utils.errors.InvalidDateFormat[source]
Bases:
ExceptionRaised when the date provided is in an incorrect or unsupported format
- exception utils.errors.InvalidIncludes[source]
Bases:
ExceptionRaised when an invalid object is passed as an includes argument
- exception utils.errors.InvalidTimezoneError[source]
Bases:
ExceptionRaised when an unrecognized or invalid timezone is provided
- exception utils.errors.MalformedResponseError[source]
Bases:
ExceptionRaised when the response from the API does not contain ‘data’.
- exception utils.errors.ParameterException[source]
Bases:
ExceptionRaised when an incorrect parameter type is provided
- exception utils.errors.ParameterLengthException[source]
Bases:
ExceptionRaised when the number of parameters requested in a single API call exceeds the allow amount
- exception utils.errors.SportMonksAPIError[source]
Bases:
ExceptionRaised when SportMonks returns an API error.
utils.helper module
- utils.helper.validate_date_format(date_str: str) bool[source]
Validates if the provided date is in the format ‘YYYY-mm-dd’ that SportMonks requires.
- Args:
date_str (str): The date string to validate.
- Returns:
bool: True if the date is valid and in the correct format, False otherwise.
- utils.helper.validate_date_order(date1: str, date2: str) bool[source]
Validates if the first date is not after the second date. A range of more than 100 days is also invalid.
- Args:
date1 (str): The first date in ‘YYYY-mm-dd’ format. date2 (str): The second date in ‘YYYY-mm-dd’ format.
- Returns:
bool: True if date1 <= date2, False if not, False if the range exeeds 100 days.
Module contents
Core endpoints common to all sports within SportMonks included in all subscriptions