This is an async adaption of the Pokémon TCG SDK for Python. It is a wrapper around the Pokémon TCG API of pokemontcg.io.
Python >= 3.6
This library uses aiohttp. The documentation suggests installing this two optional library:
- cchardet: cChardet is high speed universal character encoding detector - binding to charsetdetect.
- aiodns: DNS resolver for asyncio.
Wrap all the coroutines that needs to use the API inside one AsyncClientContext(). The AsyncClientContext will automatically open and close the underlying aiohttp session. You can also wrap your entire application.
async with AsyncClientContext(api_key='12345678-1234-1234-1234-123456789ABC'):
await all_your_coroutines_that_use_the_api()
Import (Card and Set will be most used)
from pokemontcgsdk import Card
from pokemontcgsdk import Set
from pokemontcgsdk import Type
from pokemontcgsdk import Supertype
from pokemontcgsdk import Subtype
from pokemontcgsdk import Rarity
Card
Set
Type
Supertype
Subtype
Rarity
abilities
artist
ancientTrait
attacks
convertedRetreatCost
evolvesFrom
flavorText
hp
id
images
legalities
regulationMark
name
nationalPokedexNumbers
number
rarity
resistances
retreatCost
rules
set
subtypes
supertype
tcgplayer
types
weaknesses
id
images
legalities
name
printedTotal
ptcgoCode
releaseDate
series
total
updatedAt
card = await Card.find('xy1-1').get()
# List (may take a while)
cards = await Card.where(q='set.name:generations supertype:pokemon').get()
# Generator
async for card in Card.where(q='set.name:generations supertype:pokemon').generator():
...
# List (will take a while)
cards = await Card.all().get()
# Generator
async for card in Card.all().generator():
...
cards = await Card.where(page=5, pageSize=250).get()
set = await Set.find('base1').get()
# List
sets = await Set.where(q='legalities.standard:legal').get()
# Generator
async for set in Set.where(q='legalities.standard:legal').generator():
...
# List
sets = await Set.all().get()
# Generator
async for set in Set.all().generator():
...
types = await Type.all().get()
subtypes = await Subtype.all().get()
supertypes = await Supertype.all().get()
rarities = await Rarity.all().get()