Python SDK for TCG Price Lookup — live trading card prices across Pokemon, MTG, Yu-Gi-Oh, Lorcana, One Piece, SWU, Flesh and Blood
Project description
tcglookup-py
The official Python SDK for the TCG Price Lookup API — live trading card prices across Pokemon, Magic: The Gathering, Yu-Gi-Oh!, Disney Lorcana, One Piece TCG, Star Wars: Unlimited, and Flesh and Blood.
One API for every major trading card game. TCGPlayer market prices, eBay sold averages, and PSA / BGS / CGC graded comps — all in one place.
Install
pip install tcglookup
Quickstart
from tcglookup import TcgLookupClient
client = TcgLookupClient(api_key="tlk_live_...")
# Search for cards
results = client.cards.search(q="charizard", game="pokemon", limit=5)
for card in results["data"]:
print(card["name"], card["prices"]["raw"])
# Get a single card by ID
card = client.cards.get("a3f8c1e2-...")
print(card["name"], card["prices"])
# Daily price history (Trader plan and above)
history = client.cards.history("a3f8c1e2-...", period="30d")
for day in history["data"]:
print(day["date"], day["prices"])
# List all supported games
for game in client.games.list()["data"]:
print(game["slug"], game["name"], game["count"], "cards")
Get an API key
Sign up at tcgpricelookup.com/tcg-api. Free tier includes 10,000 requests per month with TCGPlayer market prices. Trader plan unlocks eBay sold averages, PSA / BGS / CGC graded prices, and full price history.
API surface
Cards
client.cards.search(
q="blue-eyes white dragon",
game="yugioh", # pokemon | mtg | yugioh | onepiece | lorcana | swu | fab
set="lob", # set slug
limit=20,
offset=0,
)
client.cards.get("<card-uuid>")
client.cards.history("<card-uuid>", period="30d") # 7d | 30d | 90d | 1y
Sets
client.sets.list(game="mtg", limit=50)
Games
client.games.list()
Batch lookups
Pass an iterable of IDs and the SDK auto-chunks into 20-ID batches:
results = client.cards.search(ids=["uuid1", "uuid2", ..., "uuid100"])
Error handling
from tcglookup import (
TcgLookupClient,
AuthenticationError,
PlanAccessError,
NotFoundError,
RateLimitError,
)
client = TcgLookupClient(api_key="tlk_live_...")
try:
history = client.cards.history("<uuid>", period="1y")
except AuthenticationError:
print("Bad API key")
except PlanAccessError:
print("History requires Trader plan — upgrade at tcgpricelookup.com/tcg-api")
except NotFoundError:
print("That card doesn't exist")
except RateLimitError:
print(f"Rate limited. Quota: {client.rate_limit.remaining}/{client.rate_limit.limit}")
Rate limits
After every successful request, the most recent rate-limit headers are available on the client:
client.cards.search(q="pikachu")
print(client.rate_limit.remaining, "/", client.rate_limit.limit)
Use as a context manager
with TcgLookupClient(api_key="tlk_live_...") as client:
cards = client.cards.search(q="black lotus", game="mtg")
# HTTP connection pool is closed automatically
Sister SDKs
- tcglookup-js — JavaScript / TypeScript
- tcglookup-go — Go
- tcglookup-rs — Rust
- tcglookup-php — PHP
- tcglookup CLI — terminal client
- tcg-api-examples — runnable code samples in 8 languages
- tcg-discord-bot — self-hosted Discord bot with slash commands
The full developer ecosystem index lives at awesome-tcg.
License
MIT — see LICENSE.
Built by TCG Price Lookup. Get a free API key at tcgpricelookup.com/tcg-api.
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 tcglookup-0.1.0.tar.gz.
File metadata
- Download URL: tcglookup-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec5d367bc24ce16b222e127c79787757b039568cc9d66c3d4dc72ee1dfb58e45
|
|
| MD5 |
d38be918ac4178fa89355a5da5a7ddf9
|
|
| BLAKE2b-256 |
2ea49e6506c2192fa6f5f5a9db18c0a6e60ab23cdf3a3563525601cd4a200bde
|
File details
Details for the file tcglookup-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tcglookup-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47dd320e0e20c3e9f5e7c84c85b96617a433c44f79ef2894e1dc115b4675d93a
|
|
| MD5 |
cd573183d3f2b6213a9d3cc7d49ef39c
|
|
| BLAKE2b-256 |
814e6e4eefabaef75d3fa002c83f16622fd1ea60e8d1493bec4a73ed0413d98a
|