multigp_toolkit.multigpapi#

MultiGP RaceSync API Access

Attributes#

logger

Module logger

T

Generic for typing

U

Generic for typing

BASE_API_URL

MultiGP API base URL

Classes#

MultiGPAPI

The primary class used to interact with the MultiGP RaceSync API

Module Contents#

multigp_toolkit.multigpapi.logger#

Module logger

multigp_toolkit.multigpapi.T#

Generic for typing

multigp_toolkit.multigpapi.U#

Generic for typing

multigp_toolkit.multigpapi.BASE_API_URL = 'https://www.multigp.com/mgp/multigpwebservice'#

MultiGP API base URL

class multigp_toolkit.multigpapi.MultiGPAPI(rhapi)#

Bases: multigp_toolkit.abstracts._APIManager

The primary class used to interact with the MultiGP RaceSync API

_api_key: str | None = None#

Chapter API key

_chapter_id: int | None = None#

MultiGP id for the chapter

_request_and_parse(request_type, url, json_request)#

Request data from the MultiGP API and parse it’s output

Parameters:
Returns:

The parsed data

Return type:

Union[dict[str, bool], dict[str, U]]

set_api_key(api_key)#

Sets the MultiGP api key for

Parameters:
  • apiKey – The MultiGP api key for the chapter

  • api_key (str)

Return type:

None

pull_chapter()#

Find the chapter for the set RaceSync API key.

Returns:

The name of the Chapter, returns None if chapter not found

Return type:

Union[str, None]

pull_races()#

Pull the avaliable races for the chapter.

Returns:

Keypair of the race id and the race name. Returns

Return type:

Union[dict[int, str], None]

None if race not found.

pull_race_data(race_id)#

retrieve the race data for a specific race.

Parameters:

race_id (str) – The MultiGP id for the race.

Returns:

_description_

Return type:

Union[dict[str, U], None]

pull_additional_rounds(race_id, round_num)#

Downloads round informtions. Typcially used for ZippyQ.

Parameters:
  • race_id (str) – ID of the t

  • round_num (int) – Round number to pull

Returns:

The race data for the round

Return type:

Union[dict[str, U], None]

push_slot_and_score(captured_data)#

Push individual results to the RaceSync API

Parameters:

captured_data (tuple[str, int, int, int, dict]) – Data to send to RaceSync. Elements of the tuple include

(race_id, round_number, heat_number, slot_number, race_data). :return: The status of the results push

push_overall_race_results(race_id, bracket_results)#

Push the overall results to the RaceSync API

Parameters:
  • race_id (str) – The race id

  • bracket_results (list[dict[str, int]]) – A list of pilot rankings

Returns:

The status of the reuslts push