Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API has changed: tactics doesn't work #34

Closed
demiaus opened this issue May 30, 2023 · 4 comments
Closed

API has changed: tactics doesn't work #34

demiaus opened this issue May 30, 2023 · 4 comments

Comments

@demiaus
Copy link

demiaus commented May 30, 2023

Lichess API and Berserk have updated resulting in 404 response querying puzzles with the old version. Updating Berserk fixes the url path but results in more errors by Omegaconf. After Berserk update:

.
.
.
  File "/home/user/chessli/lib/python3.11/site-packages/chessli/cli/tactics.py", line 40, in ls
    tactics_manager.print_new_puzzles()
  File "/home/user/chessli/lib/python3.11/site-packages/chessli/tactics.py", line 103, in print_new_puzzles
    puzzle_ids = self._get_ids_from_puzzle_activity(puzzle_activity)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/chessli/lib/python3.11/site-packages/chessli/tactics.py", line 80, in _get_ids_from_puzzle_activity
    if self.config.failed_only:
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 355, in __getattr__
    self._format_and_raise(
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/base.py", line 231, in _format_and_raise
    format_and_raise(
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/_utils.py", line 899, in format_and_raise
    _raise(ex, cause)
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/_utils.py", line 797, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set env var OC_CAUSE=1 for full trace
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 351, in __getattr__
    return self._get_impl(
           ^^^^^^^^^^^^^^^
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 442, in _get_impl
    node = self._get_child(
           ^^^^^^^^^^^^^^^^
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/basecontainer.py", line 73, in _get_child
    child = self._get_node(
            ^^^^^^^^^^^^^^^
  File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 480, in _get_node
    raise ConfigKeyError(f"Missing key {key!s}")
omegaconf.errors.ConfigAttributeError: Missing key failed_only
    full_key: failed_only
    object_type=dict
@maneeshsethi
Copy link

I am also getting this error.

@maneeshsethi
Copy link

Anyone know a fix to this issue?

@cyrillkuettel
Copy link

cyrillkuettel commented Aug 15, 2023

Also getting this error. (After running poetry update berserk which did ineed fix the previous error.


https://lichess.org/api#tag/Puzzles/operation/apiPuzzleActivity

Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/berserk/exceptions.py", line 63, in _catch_exception
    response.raise_for_status()
  File "/opt/homebrew/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://lichess.org/api/user/puzzle-activity

TL;DR; We're calling a deprecated method in berserk. Should be using Puzzles.get_puzzle_activity not the deprecated get_puzzle_activity

This is wrong (deprecated method in latest version of v0.12.8):

    def get_puzzle_activity(self, max=None):
        """Stream puzzle activity history starting with the most recent.

        :param int max: maximum number of entries to stream
        :return: puzzle activity history
        :rtype: iter
        """
- path = 'api/user//puzzle-activity'
+ path = 'api/user/puzzle/activity'
        params = {'max': max}
        return self._r.get(path, params=params, fmt=NDJSON, stream=True,
                           converter=models.PuzzleActivity.convert)

If you compare berserk/clients.py::get_puzzle_activity with the Lichess apiUserActivity Docs it is puzzle/activity

Side note:
This error can be reproduced by running:

poetry update berserk
chessli --user DrDrunkenstein tactics ankify --export-only

@pwenker
Copy link
Owner

pwenker commented Apr 11, 2024

Hello everyone, sorry for the very late response!

I am developing a new simplified version of chessli with a graphical user interface.
Since I switch to the new https://github.com/lichess-org/berserk this issue will become obsolete.

@pwenker pwenker closed this as completed Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants