MCPcopy Index your code
hub / github.com/crustymonkey/py-bgg

github.com/crustymonkey/py-bgg @1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.0 ↗ · + Follow
40 symbols 110 edges 10 files 26 documented · 65%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

py-bgg

A simple Board Game Geek (boardgamegeek.com) API library in Python. This mainly just handles the API calls and converts the XML to representative dict/list format

0.3.0 has moved to Python3 ONLY. Python2 is dead, long live Python2.

INSTALL

Installation is pretty easy. You can just to the standard as root:

tar -xvzf py-bgg-*.tar.gz
cd py-bgg-*
python setup.py install

You can also install directly using pip

pip install py-bgg

USAGE

This follows the BGG api pretty closely so this should be self-explanatory with "pydoc libbgg" and the api definition at:

http://boardgamegeek.com/wiki/page/BGG_XML_API http://boardgamegeek.com/wiki/page/BGG_XML_API2

BASIC TUTORIAL

This library will essentially just convert your calls into a URL and subsequently return a dict/list tree of objects that are accessible via standard object notation or dictionary style access

#!/usr/bin/env python3

import json
from libbgg.apiv1 import BGG
# You can also use version 2 of the api:
from libbgg.apiv2 import BGG as BGG2

API_KEY = 'abc123'

conn = BGG(API_KEY)

# Perform a search
results = conn.search('bruges')
print(json.dumps(results, indent=4, sort_keys=True))

# Print out a list of names that were returned
for game in results.boardgames.boardgame:
    print(game.name.TEXT)

# You can also access items as a dictionary
for game in results['boardgames']['boardgame']:
    print(game['name']['TEXT'])

# Get game info
results = conn.get_game(136888 , stats=True)
print(json.dumps(results, indent=4, sort_keys=True))

# V2
conn2 = BGG2(API_KEY)
results = conn2.boardgame(136888, stats=True)
print(json.dumps(results, indent=4, sort_keys=True))

# Batch gets with a list, tuple, or comma separated str
conn2 = BGG2(API_KEY)

results = conn2.boardgame((136888, 136889), stats=True)
# or
results = conn2.boardgame("136888,136889", stats=True)

print(json.dumps(results, indent=4, sort_keys=True))

Core symbols most depended-on inside this repo

call
called by 17
libbgg/apibase.py
_get_opener
called by 2
libbgg/apibase.py
xml_to_info_dict
called by 1
libbgg/infodict.py
_build_dict_from_xml
called by 1
libbgg/infodict.py
_strip_NS
called by 1
libbgg/infodict.py
_get_root
called by 1
libbgg/infodict.py
_family_items
called by 0
libbgg/apiv2.py
_things
called by 0
libbgg/apiv2.py

Shape

Method 32
Class 7
Route 1

Languages

Python100%

Modules by API surface

libbgg/apiv2.py14 symbols
libbgg/tests/test_apiv1.py7 symbols
libbgg/apiv1.py7 symbols
libbgg/infodict.py6 symbols
libbgg/apibase.py4 symbols
libbgg/errors.py2 symbols

For agents

$ claude mcp add py-bgg \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact