Skip to content

"BGGApiError: non-XML reply" in request_and_parse_xml when getting a game list #74

@outis

Description

@outis

Synopsis.

Calling BGGClient.game_list with more than 20 game IDs results in a BGGApiError exception with the error message "non-XML reply".

Code

import boardgamegeek as bgg
client = bgg.BGGClient()
client.game_list(list(range(21)))

Running the above results in the following output:

Traceback (most recent call last):
  File "boardgamegeek/utils.py", line 346, in request_and_parse_xml
    raise BGGApiError("non-XML reply")
boardgamegeek.exceptions.BGGApiError: non-XML reply

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "boardgamegeek/api.py", line 821, in game_list
    xml_root = request_and_parse_xml(self.requests_session,
                                     self._thing_api_url,
    ...<2 lines>...
                                     retries=self._retries,
                                     retry_delay=self._retry_delay)
  File "boardgamegeek/utils.py", line 376, in request_and_parse_xml
    raise BGGApiError("error fetching BGG API response: {}".format(e))
boardgamegeek.exceptions.BGGApiError: error fetching BGG API response: non-XML reply

The non-XML response is the plain text: "Cannot load more than 20 items".

Cause

In July of 2024, the BoardGameGeek XML API and XML API 2 were updated to return a maximum of 20 items (https://boardgamegeek.com/thread/3336313/max-20-items-from-xml-api-and-xml-api-2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions