Skip to content

Commit

Permalink
Fix params for request with ratings filter
Browse files Browse the repository at this point in the history
  • Loading branch information
qpwoeirut committed Jul 13, 2024
1 parent 2518b6c commit c503be4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion homemade.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ def get_opening_explorer_move_list(self, board: chess.Board) -> tuple[list[dict[
if response["moves"]:
return response["moves"], OpeningsBotModeEnum.PLAYER_OPENINGS
else: # if there's no moves found, try the general opening explorer next at the player's rating or higher
# Passing in a list causes duplicate arguments instead of a comma-separated list
ratings = ','.join([str(rating) for rating in RATINGS if rating >= self.opening_book_player_rating])
params = {"fen": board.fen(), "moves": 100, "variant": variant, "topGames": 0, "recentGames": 0,
"ratings": [rating for rating in RATINGS if rating >= self.opening_book_player_rating]}
"ratings": ratings}
response = self.li.online_book_get("https://explorer.lichess.ovh/lichess", params)
return response["moves"], OpeningsBotModeEnum.GENERAL_OPENINGS

Expand Down

0 comments on commit c503be4

Please sign in to comment.