Client
The Client module provides the main interface to the API.
ctftime_api.CTFTimeClient
¶
CTFTimeClient(client: AsyncClient | None = None, **kwargs)
:param kwargs: Kwargs that will be passed to the httpx.AsyncClient constructor.
get_top_teams_per_year
async
¶
Get the top teams in the leaderboard for a specific year. :param year: The year to get the top teams for. If None, the current year will be used. :param limit: The number of teams to get. :return: A list of the top teams. :raise httpx.HTTPStatusError: If the response status code is not successful.
get_top_team_by_country
async
¶
get_top_team_by_country(
country: str | CountryAlpha2,
) -> list[TeamRank]
Get the top teams in the leaderboard for a specific country. :param country: The country to get the top teams for. It can be a pycountry Country object or a two-letter country code. :return: A list of the top teams. :raise httpx.HTTPStatusError: If the response status code is not successful. :raise ValueError: If the country is not a two-letter country code or a pycountry Country object.
get_events_information
async
¶
get_events_information(
start: int | datetime,
end: int | datetime,
limit: int = 10,
) -> list[Event]
Get information about events that are happening between two dates. :param start: The start date of the events. It can be a Unix timestamp or a datetime object. :param end: The end date of the events. It can be a Unix timestamp or a datetime object. :param limit: The number of events to get. :return: A list of events. :raise httpx.HTTPStatusError: If the response status code is not successful. :raise ValueError: If the start date is after the end date.
get_event_information
async
¶
Get information about a specific event. :param event_id: The ID of the event. :return: The event information. :raise httpx.HTTPStatusError: If the response status code is not successful.
get_teams_information
async
¶
Get information about teams. :param limit: The number of teams to get. :param offset: The offset to start from. :return: A list of teams. :raise httpx.HTTPStatusError: If the response status code is not successful.
get_team_information
async
¶
get_team_information(team_id: int) -> TeamComplete
Get information about a specific team. :param team_id: The ID of the team. :return: The team information. :raise httpx.HTTPStatusError: If the response status code is not successful.
get_event_results
async
¶
get_event_results(
year: int | None = None,
) -> dict[int, EventResult]
Get the results of the events for a specific year. :param year: The year to get the results for. If None, the current year will be used. :return: A dictionary of event results. :raise httpx.HTTPStatusError: If the response status code is not successful.
get_votes_per_year
async
¶
Get the votes for a specific year. This API call may take a long time to complete. :param year: The year to get the votes for or None for the current year. :param timeout: The timeout for the request. If None, the session timeout will be used. :return: A list of votes. :raise httpx.HTTPStatusError: If the response status code is not successful.