### Install pychallonge Source: https://github.com/zedgr/pychallonge/blob/master/README.md Install the pychallonge library using pip for the stable version or the latest development version directly from GitHub. ```shell pip install pychallonge pip install -e git+http://github.com/ZEDGR/pychallonge#egg=pychallonge ``` -------------------------------- ### Basic pychallonge Usage Source: https://github.com/zedgr/pychallonge/blob/master/README.md Demonstrates how to set API credentials, retrieve tournament details by ID, list participants for a tournament, and start a tournament. All data is returned as Python dictionaries. ```python import challonge # Tell pychallonge about your CHALLONGE! API credentials. challonge.set_credentials("your_challonge_username", "your_api_key") # Retrieve a tournament by its id (or its url). tournament = challonge.tournaments.show(3272) # Tournaments, matches, and participants are all represented as normal Python dicts. print(tournament["id"]) print(tournament["name"]) print(tournament["started_at"]) # Retrieve the participants for a given tournament. participants = challonge.participants.index(tournament["id"]) print(len(participants)) # Start the tournament and retrieve the updated information to see the effects # of the change. challonge.tournaments.start(tournament["id"]) tournament = challonge.tournaments.show(tournament["id"]) print(tournament["started_at"]) ``` -------------------------------- ### CHALLONGE! API Methods Source: https://github.com/zedgr/pychallonge/blob/master/README.md This section outlines common methods available through the pychallonge library for interacting with the CHALLONGE! API. It covers tournament management, participant retrieval, and cleanup operations. ```APIDOC challonge.set_credentials(username, api_key) - Sets the API credentials for authentication. - Parameters: - username: Your CHALLONGE! username (string). - api_key: Your CHALLONGE! API key (string). challonge.tournaments.show(tournament_id_or_url) - Retrieves details for a specific tournament. - Parameters: - tournament_id_or_url: The ID or URL slug of the tournament (integer or string). - Returns: A dictionary representing the tournament details. challonge.participants.index(tournament_id) - Retrieves a list of participants for a given tournament. - Parameters: - tournament_id: The ID of the tournament (integer). - Returns: A list of dictionaries, each representing a participant. challonge.tournaments.start(tournament_id) - Starts a tournament. - Parameters: - tournament_id: The ID of the tournament to start (integer). - Returns: Updated tournament details after starting. challonge.tournaments.index() - Retrieves a list of all tournaments associated with the account. - Returns: A list of tournament dictionaries. challonge.tournaments.destroy(tournament_id) - Deletes a tournament. - Parameters: - tournament_id: The ID of the tournament to destroy (integer). # Example for cleaning up tournaments starting with 'pychal' # challonge.set_credentials("my_user", "my_api_key") # for t in challonge.tournaments.index(): # if t["name"].startswith("pychal"): # challonge.tournaments.destroy(t["id"]) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.