lcosmin / boardgamegeek

A Python interface to boardgamegeek.com. Pulls information from BGG and creates Python objects for the data.
BSD 3-Clause "New" or "Revised" License
118 stars 71 forks source link

Docs: player_suggestions should be suggested_numplayers? #44

Closed EmilStenstrom closed 6 years ago

EmilStenstrom commented 6 years ago

Hi! Thanks for a great library. The BoardGame class has, according to the docs, a player_suggestions property. But I get KeyError trying to access it. I do get info back with the name suggested_numplayers, could that have changed, without the docs being updated?

lcosmin commented 6 years ago

Hmm, this is weird, for what game are you getting a KeyError ? Can you provide some code?

Using the object from your other issue:

>>> game.player_suggestions
[<boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25cd0>, <boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25d10>, <boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25d50>, <boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25d90>, <boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25dd0>, <boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25e10>, <boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25e50>, <boardgamegeek.objects.games.PlayerSuggestion object at 0x108a25e90>]

It also shouldn't work with .suggested_numplayers ...

EmilStenstrom commented 6 years ago

That is really strange, do I have another version of the library?

>>> client = BGGClient()
>>> game = client.game(game_id=68448)
>>> game
BoardGame (id: 68448)
>>> game.player_suggestions
Traceback (most recent call last):
  File "/Users/EmilStenstrom/Envs/mybgg/lib/python3.6/site-packages/boardgamegeek/utils.py", line 98, in __getattr__
    return self._data[item]
KeyError: 'player_suggestions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/EmilStenstrom/Envs/mybgg/lib/python3.6/site-packages/boardgamegeek/utils.py", line 100, in __getattr__
    raise AttributeError
AttributeError

Wait a minute. I should be using https://pypi.org/project/boardgamegeek2/ right? Version 0.0.1?

lcosmin commented 6 years ago

Yeah, you need to use boardgamegeek2, but I don't think I've released this change to PyPI.

Try to see if installing the package like this solves your issue: pip install git+https://github.com/lcosmin/boardgamegeek.git@develop

EmilStenstrom commented 6 years ago

That solves it, thanks! Looking forward to a new release to PyPI! :)

lcosmin commented 6 years ago

Pushed version 1.0.0rc2 to PyPI