Age of Empires II - Current Match (Python Script).

Check out the GitHub repository.

This code fetches information about the most recent (or ongoing) Age of Empires II match played by a specific profile and gives details such as ELO rating, civ and bonuses.

Functions:

  • get_civilization_descriptions(file_path): This function reads a JSON file containing civilization descriptions and bonuses, and returns a dictionary where the key is the civilization name and the value is its description.
  • get_match_info(api_url, civilizations_file): This is the main function that retrieves and processes match data.
    • It takes the API URL and the path to the civilization data file as input.
    • It sends a request to the provided API to get match information for a specific profile.
    • If the request is successful (status code 200), it parses the JSON response and extracts details of the most recent match, including map name, start time, and player information (names, ratings, and civilizations).
    • It then calls the get_civilization_descriptions function to get descriptions for each player’s civilization from the provided file.
    • Finally, it returns a dictionary containing all the retrieved match information, including player details and civilization descriptions.

Output

Output

Related Posts