Skip to main content

Pokemon TCG SDK for pokemontcg.io using asyncio

Project description

Pokémon TCG SDK

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.

Requirements

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.

Usage

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

Classes

Card
Set
Type
Supertype
Subtype
Rarity

Properties Per Class

Card

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

Set

id
images
legalities
name
printedTotal
ptcgoCode
releaseDate
series
total
updatedAt

Functions Available

Find a card by id

card = await Card.find('xy1-1').get()

Filter Cards via query parameters

# 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():
    ...

Find all cards

# List (will take a while)
cards = await Card.all().get()

# Generator
async for card in Card.all().generator():
    ...

Get all cards, but only a specific page of data

cards = await Card.where(page=5, pageSize=250).get()

Find a set by code

set = await Set.find('base1').get()

Filter sets via query parameters

# List
sets = await Set.where(q='legalities.standard:legal').get()

# Generator
async for set in Set.where(q='legalities.standard:legal').generator():
    ...

Get all Sets

# List
sets = await Set.all().get()

# Generator
async for set in Set.all().generator():
    ...

Get all Types

types = await Type.all().get()

Get all Subtypes

subtypes = await Subtype.all().get()

Get all Supertypes

supertypes = await Supertype.all().get()

Get all Rarities

rarities = await Rarity.all().get()

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

pokemontcgsdkasync-0.2.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pokemontcgsdkasync-0.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file pokemontcgsdkasync-0.2.0.tar.gz.

File metadata

  • Download URL: pokemontcgsdkasync-0.2.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pokemontcgsdkasync-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4396e459e9c317a11e4622d77b809c172e662a839bc1471335c89082e4539541
MD5 4966782c412273ce18c6ad8fa23094b1
BLAKE2b-256 244ef2c0debf1622a4a77db2b5d2e4fd30518e5380edd851670f3f5fbcb010b6

See more details on using hashes here.

File details

Details for the file pokemontcgsdkasync-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pokemontcgsdkasync-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for pokemontcgsdkasync-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f00c0df5e467ac63c9b9ec8119ebee4ae3e10f59848d033711989b483b1b39d
MD5 59d1b532cfcf282c11b17067c38a23ee
BLAKE2b-256 3abe13460f79fba75a76e75ecb6b442875bd54e0842623600f9d13de72cc1c01

See more details on using hashes here.

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