A modern, async python client for BoardGameGeek.
Project description
🎲 bgg-pi
A modern, high-performance asynchronous Python client for BoardGameGeek.
bgg-pi is designed for developers who need reliable, non-blocking access to BoardGameGeek data. Whether you're building a Home Assistant integration, a discord bot, or a data analysis tool, bgg-pi makes it effortless.
✨ Features
- 🚀 Fully Async: Built on top of
aiohttpto keep your applications responsive. - ✍️ Record Plays: One of the few libraries that supports logging plays directly to a BGG account.
- 📦 Collection Management: Fetch user collections with options to filter by ownership, wishlist status, and more.
- 🎨 Rich Metadata: Retrieve high-fidelity game details including box art, ranks, weight, and play times.
- 🛡️ Type Safe: Fully typed codebase for excellent IDE autocompletion and error checking.
🚀 Installation
Install via pip:
pip install bgg-pi
🛠️ Quick Start
Fetching User Plays
import asyncio
import aiohttp
from bgg_pi import BggClient
async def main():
async with aiohttp.ClientSession() as session:
client = BggClient(session, username="your_username")
# specific api token is optional for public data but recommended
plays = await client.fetch_plays()
print(f"Found {plays['total']} plays!")
# Access simple play data
if plays['last_play']:
print(f"Last played: {plays['last_play']['game']} on {plays['last_play']['date']}")
if __name__ == "__main__":
asyncio.run(main())
Logging a Play
Authenticate securely and log your gaming sessions:
async def log_play():
async with aiohttp.ClientSession() as session:
# Password is required for play logging
client = BggClient(session, username="seanmccabe", password="secret_password")
if await client.login():
success = await client.record_play(
game_id=13, # Catan
date="2026-01-16",
comments="Great game with friends!",
length="90",
players=[
{"name": "Sean", "win": True, "score": "10"},
{"name": "Friend", "win": False, "score": "8"}
]
)
if success:
print("Play recorded successfully!")
📚 Documentation
The client covers the most essential BGG XML API2 and GeekPlay endpoints:
fetch_plays(): Get logged plays.fetch_collection(): Get a user's board game collection (with filters).fetch_thing_details([ids]): Get detailed metadata for specific games.fetch_game_plays(id): Get play counts for a specific game.record_play(...): Post a new play to BGG.
📦 Projects using bgg-pi
- Home Assistant BoardGameGeek Integration: A comprehensive integration for tracking collection and plays in Home Assistant.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bgg_pi-0.1.0.tar.gz.
File metadata
- Download URL: bgg_pi-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48f02ea20cad4b421a7eef2e727900c9d2033020a5be86418483805b97b95ff2
|
|
| MD5 |
00c8af895af292f039948847ec267c32
|
|
| BLAKE2b-256 |
c332a039dd1504015280dd5d94e34c7c3d8fc4266b9606d4fd611dbf43d73000
|
Provenance
The following attestation bundles were made for bgg_pi-0.1.0.tar.gz:
Publisher:
publish.yaml on seanmccabe/bgg-pi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bgg_pi-0.1.0.tar.gz -
Subject digest:
48f02ea20cad4b421a7eef2e727900c9d2033020a5be86418483805b97b95ff2 - Sigstore transparency entry: 830139291
- Sigstore integration time:
-
Permalink:
seanmccabe/bgg-pi@1292047b983fe66133b986f8905a17a54a967828 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/seanmccabe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@1292047b983fe66133b986f8905a17a54a967828 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bgg_pi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bgg_pi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88cbbcd658b05b98a94a2cb1856e16bb6ac3cabed8088e229215e0d7889e0d6f
|
|
| MD5 |
90ac52fb2c0bb3ecba1f2f71decae195
|
|
| BLAKE2b-256 |
f8e17b2a2b78f5d1e7cc4f4288598d600b4e0e040ae22db0e67a139eb565f6eb
|
Provenance
The following attestation bundles were made for bgg_pi-0.1.0-py3-none-any.whl:
Publisher:
publish.yaml on seanmccabe/bgg-pi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bgg_pi-0.1.0-py3-none-any.whl -
Subject digest:
88cbbcd658b05b98a94a2cb1856e16bb6ac3cabed8088e229215e0d7889e0d6f - Sigstore transparency entry: 830139336
- Sigstore integration time:
-
Permalink:
seanmccabe/bgg-pi@1292047b983fe66133b986f8905a17a54a967828 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/seanmccabe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@1292047b983fe66133b986f8905a17a54a967828 -
Trigger Event:
release
-
Statement type: