Skip to main content

Python client and CLI for the BoardGameGeek XML API

Project description

bgg-search

bgg-search is a Python package and command-line tool for querying the BoardGameGeek XML API. It lets you search for board games by name and retrieve full game details — player counts, play time, weight, BGG rating, and more — from the command line or from your own Python code.

Contents:

Installation

pip install bgg-search

Requires Python ≥ 3.13.

A BGG API token is required to make requests. Obtain one by registering your application at https://boardgamegeek.com/applications.

The token is resolved in this order — the first source found is used:

  1. --token-file PATH — CLI option pointing to a file containing the token.
  2. BGG_TOKEN — environment variable.
  3. .bgg-token — plain-text file in the current working directory.

If none of the above is provided, the command exits with code 1 and prints an error to stderr.

Quickstart

CLI

export BGG_TOKEN=<your-token>

# Search for games matching a query
bgg-search search "Catan"
#       13  Catan
#   396790  Catan: New Energies
#      ...

# Fetch full details for a game by its BGG ID
bgg-search details 13
# id:            13
# name:          Catan
# year:          1995
# min_players:   3
# max_players:   4
# ...

Python API

import os
from bgg_search import BggClient, search_games, get_game

client = BggClient(token=os.environ["BGG_TOKEN"])

results = search_games("Catan", client)
for game in results:
    print(game.id, game.name)

details = get_game(13, client)
print(details.name, details.bgg_rating)

Documentation

Development

See CONTRIBUTING.md.

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_search-0.5.0.tar.gz (33.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_search-0.5.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file bgg_search-0.5.0.tar.gz.

File metadata

  • Download URL: bgg_search-0.5.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bgg_search-0.5.0.tar.gz
Algorithm Hash digest
SHA256 0d11d8f47cfb7cb62e21786cfbd783166e3759f39f69d087abd4562675b7eab6
MD5 824258b1a3e01145ad2d3dd6d5d5dbe3
BLAKE2b-256 5258e8cb4d46ad59c687eb30eba828af77077969749883d2606f6526f7088c80

See more details on using hashes here.

Provenance

The following attestation bundles were made for bgg_search-0.5.0.tar.gz:

Publisher: publish.yml on arnauldvm/bgg-search

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_search-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: bgg_search-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bgg_search-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 906a62985d1cb276436a2a71c97d33d03d6d8a5c2ff0d668bfa3caabc2e12b2a
MD5 dc10a928e431c9fcda02576122fd0ccd
BLAKE2b-256 abe0c718c6514404eda6a2e8fa3604c0325681f8845cda4a6bfdcb08c655c0e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for bgg_search-0.5.0-py3-none-any.whl:

Publisher: publish.yml on arnauldvm/bgg-search

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