A Python interface to boardgamegeek.com's API
boardgamegeek is a Python library which makes it easy to access data off BoardGameGeek using their official XML API.
It’s an almost completely rewritten fork of libBGG.
The module’s API is still considered unstable at this point and it might change in the future, especially if wanting to add support for the other sites.
This library exposes (as Python objects with properties) the following BoardGameGeek entities:
- User collections
- Player guilds
requests-cache is used for locally caching replies in order to reduce the amount of requests sent to the server.
At the moment, the cache is enabled by default and it’s configured to use a memory cache only.
To install boardgamegeek, just use pip:
> pip install boardgamegeek
Documentation is available at http://boardgamegeek.readthedocs.org/
Here’s a quick usage example:
>>> from boardgamegeek import BoardGameGeek >>> bgg = BoardGameGeek() >>> g = bgg.game("Android: Netrunner") >>> g.name 'Android: Netrunner' >>> g.id 124742 >>> for n in g.alternative_names: print n.encode("utf-8") ... 安卓纪元：矩阵潜袭
If you want to use the disk cache:
>>> bgg = BoardGameGeek(cache="sqlite:///tmp/cache.db?ttl=3600&fast_save=0") >>> g = bgg.game("Celtica") >>> g.id 21293
- Not all the information exposed by the official API is stored into the Python objects. Need to improve this.
- Try to support the other sites from the boardgamegeek’s family
- Improve documentation :)
- Improve unit testing
Contributions/suggestions are welcome.
- Added some basic argument validation to prevent pointless calls to BGG’s API
- When some object (game, user name, etc.) is not found, the functions return None instead of raising an exception
- Collections and Guilds are now iterable
- Fixed __str__ for Collection
- Updated documentation
- Improved Python 3.x compatibility (using unicode_literals)
- Added Travis integration
- Fixed float division for Python 3.x
- Added support for retrieving an user’s buddy and guild lists
- Started implementing some basic unit tests
- Fixed handling of non-existing user names
- Properly returning the maximum number of players for a game