Games¶
- Client.export_by_id(game_id, moves=True, pgn_in_json=False, tags=True, clocks=True, evals=True, opening=True, literate=False, players=None)¶
Export an individual game
- Parameters
game_id (str) – ID of game to export
moves (Optional[bool]) – Whether to include the PGN moves
pgn_in_json (Optional[bool]) – Whether to include the full PGN within the JSON response
tags (Optional[bool]) – Whether to include the PGN tags
clocks (Optional[bool]) – Whether to include clock comments, whenever available, in the PGN moves
evals (Optional[bool]) – Whether to include analysis evaluation comments, whenever available, in the PGN
opening (Optional[bool]) – Whether to include the opening name
literate (Optional[bool]) – Whether to include textual annotations in the PGN about the opening, analysis variations, mistakes, and game termination
players (Optional[str]) – A URL of a text file containing real names and ratings to replace Lichess usernames and ratings in the PGN
- Returns
A string with PGN data of an individual game
- Return type
str
- Client.export_ongoing_by_user(user, moves=True, pgn_in_json=False, tags=True, clocks=True, evals=True, opening=True, literate=False, players=None)¶
Export the ongoing game of a user
- Parameters
user (str) – User whose ongoing game you want to export
moves (Optional[bool]) – Whether to include the PGN moves
pgn_in_json (Optional[bool]) – Whether to include the full PGN within the JSON response
tags (Optional[bool]) – Whether to include the PGN tags
clocks (Optional[bool]) – Whether to include clock comments, whenever available, in the PGN moves
evals (Optional[bool]) – Whether to include analysis evaluation comments, whenever available, in the PGN
opening (Optional[bool]) – Whether to include the opening name
literate (Optional[bool]) – Whether to include textual annotations in the PGN about the opening, analysis variations, mistakes, and game termination
players (Optional[str]) – A URL of a text file containing real names and ratings to replace Lichess usernames and ratings in the PGN
- Returns
A string with PGN data of the user’s ongoing game
- Return type
str
- Client.export_by_user(user, since=None, until=None, max_games=None, vs=None, rated=None, perf_type=None, color=None, analyzed=None, moves=True, pgn_in_json=False, tags=True, clocks=True, evals=True, opening=True, ongoing=False, finished=True, players=None, sort='dateDesc')¶
Export all the games of a user
- Parameters
user (str) – User whose games you want to export
since (Optional[int]) – Filters for games played since this timestamp (default is account creation date)
until (Optional[int]) – Filters for games played until this timestamp (default is now)
max_games (Optional[int]) – How many games to download (default downloads all games)
vs (Optional[str]) – Filter for games that are only played against this specific opponent
rated (Optional[bool]) – Filter for games that are only rated (True) or only casual (False)
perf_type (Optional[str]) – Filter for games that have a specific speed or variant
color (Optional[str]) – Filters for games only played as a specific color (“white” or “black”)
analyzed (Optional[bool]) – Whether to filter for games that have a computer analysis available
moves (Optional[bool]) – Whether to include the PGN moves
pgn_in_json (Optional[bool]) – Whether to include the full PGN within the JSON response
tags (Optional[bool]) – Whether to include the PGN tags
clocks (Optional[bool]) – Whether to include clock comments, whenever available, in the PGN moves
evals (Optional[bool]) – Whether to include analysis evaluation comments, whenever available, in the PGN
opening (Optional[bool]) – Whether to include the opening name
ongoing (Optional[bool]) – Whether to include ongoing games (last 3 moves will be omitted)
finished (Optional[bool]) – Whether to only include finished games (False to only get ongoing games)
players (Optional[str]) – A URL of a text file containing real names and ratings to replace Lichess usernames and ratings in the PGN
sort (Optional[str]) – Sort order of the games (“dateAsc” or “dateDesc”)
- Returns
A string with PGN data of all the user’s games
- Return type
str
- Client.get_ongoing(max_games=9)¶
Get your ongoing games (realtime and correspondence)
- Parameters
max_games (int) – Max number of games to fetch
- Returns
A dictionary with your ongoing games
- Return type
dict