TCGPlayer Wrapper
A Python wrapper for the TCGPlayer API.
Installation
PyPI
- Make sure you have Python installed:
python --version
- Install the project from PyPI:
pip install tcgplayer-wrapper
Github
- Make sure you have Python installed:
python --version
- Clone the repo:
git clone https://github.com/Buried-In-Code/TCGPlayer-Wrapper
- 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}")