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')

Filter Cards via query parameters

cards = await Card.where(q='set.name:generations supertype:pokemon')

Find all cards (will take a while)

cards = await Card.all()

Get all cards, but only a specific page of data

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

Find a set by code

set = await Set.find('base1')

Filter sets via query parameters

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

Get all Sets

sets = await Set.all()

Get all Types

types = await Type.all()

Get all Subtypes

subtypes = await Subtype.all()

Get all Supertypes

supertypes = await Supertype.all()

Get all Rarities

rarities = await Rarity.all()

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.1.1.tar.gz (10.0 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.1.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pokemontcgsdkasync-0.1.1.tar.gz
  • Upload date:
  • Size: 10.0 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.1.1.tar.gz
Algorithm Hash digest
SHA256 3d2a592df6bc5ced1041df2853025f9978fe17a5e2c5cfa6bef87377848f6317
MD5 7d97c0f195e4c5a3e58317769abb1862
BLAKE2b-256 8885ce7bd59d70bbc6d2feade9d0657307db704b2a4c535f36b5474ac67baa78

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pokemontcgsdkasync-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52068ecc18d68e0f2e22888f4052560dc93f722d7aaf37a425de2996766b45e4
MD5 4e018536599c49da2e144d4018d7d382
BLAKE2b-256 186f21537d8d93f54d94ac0a440e9eeb6d21bfdeb34d100e25585c093673cd93

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