Skip to main content

A modern, async python client for BoardGameGeek.

Project description

🎲 bgg-pi

PyPI version Python Versions Tests Code Style: Ruff License Contributions Welcome

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 aiohttp to 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

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bgg_pi-0.1.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bgg_pi-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file bgg_pi-0.1.1.tar.gz.

File metadata

  • Download URL: bgg_pi-0.1.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bgg_pi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 87ce2a66f5ca03308db5af5d1f68e885308275d4fca5f302b0674d6df25d949e
MD5 ee91ad5e57956fd8896c5de88abc10c7
BLAKE2b-256 b749072661e15912958a42a9c4184153137f5c3872945264b952333139905c43

See more details on using hashes here.

Provenance

The following attestation bundles were made for bgg_pi-0.1.1.tar.gz:

Publisher: publish.yaml on seanmccabe/bgg-pi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bgg_pi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bgg_pi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bgg_pi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c72a0c6c1fc2546d617247754904707a99a6b6cc10b241a5e822be7d7cb294ec
MD5 730efa2a7ce865679274e94c14cfa340
BLAKE2b-256 3e3a9a40990a0003dc838a4f135a64ce7d334086a3afdbaa5c47507b5cebd786

See more details on using hashes here.

Provenance

The following attestation bundles were made for bgg_pi-0.1.1-py3-none-any.whl:

Publisher: publish.yaml on seanmccabe/bgg-pi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page