TCGPlayer Wrapper

PyPI - Python PyPI - Status PyPI - Version PyPI - License

Hatch Pre-Commit Black isort Flake8

Github - Contributors Github Action - Code Analysis Github Action - Testing

Read the Docs

A Python wrapper for the TCGPlayer API.

Installation

PyPI

  1. Make sure you have Python installed: python --version
  2. Install the project from PyPI: pip install tcgplayer-wrapper

Github

  1. Make sure you have Python installed: python --version
  2. Clone the repo: git clone https://github.com/Buried-In-Code/TCGPlayer-Wrapper
  3. Install the project: pip install .

Example Usage

from tcgplayer.service import TCGPlayer
from tcgplayer.sqlite_cache import SQLiteCache

session = TCGPlayer(client_id="Client ID", client_secret="Client Secret", cache=SQLiteCache())

# List Games
results = session.list_categories()
for game in results:
    print(f"{game.category_id} | {game.display_name}")

# List Magic: the Gathering Expansions
results = session.list_category_groups(category_id=1)
for expansion in results:
    print(f"{expansion.group_id} | [{expansion.abbreviation}] - {expansion.name}")

# Get Product and Prices via product ID
result = session.product(product_id=257275)
prices = session.product_prices(product_id=257275)
print(f"{result.clean_name} ${prices.market_price:,.2f}")

Socials

Social - Discord