Service

TCGPlayer(client_id: str, client_secret: str, access_token: Optional[str] = None, timeout: int = 30, cache: Optional[SQLiteCache] = None)

Wrapper to allow calling TCGPlayer API endpoints.

PARAMETER DESCRIPTION
client_id

User's client id to access TCGPlayer.

TYPE: str

client_secret

User's client secret to access TCGPlayer.

TYPE: str

access_token

User's access token to access TCGPlayer, will be generated if not provided.

TYPE: Optional[str] DEFAULT: None

timeout

Set how long requests will wait for a response (in seconds).

TYPE: int DEFAULT: 30

cache

SQLiteCache to use if set.

TYPE: Optional[SQLiteCache] DEFAULT: None

ATTRIBUTE DESCRIPTION
headers

Header used when requesting from TCGPlayer.

TYPE: Dict[str, str]

client_id

TYPE: str

client_secret

TYPE: str

access_token

TYPE: str

timeout

TYPE: int

cache

TYPE: Optional[SQLiteCache]

Functions

authorization_check() -> bool

Perform an authorization check with TCGPlayer, will invalidate access token if fails.

RETURNS DESCRIPTION
bool

If the Authorization header is valid.

RAISES DESCRIPTION
ServiceError

If there is an issue with the request or response.

category(category_id: int) -> Category

Request data for a Category based on its id.

PARAMETER DESCRIPTION
category_id

The category id.

TYPE: int

RETURNS DESCRIPTION
Category

A category object.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

generate_token() -> str

Invalidate Authorization header, and request a new access token from TCGPlayer.

RETURNS DESCRIPTION
str

The new access token

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with the request or response.

group(group_id: int) -> Group

Request data for a Group based on its id.

PARAMETER DESCRIPTION
group_id

The group id.

TYPE: int

RETURNS DESCRIPTION
Group

A group object.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_categories() -> List[Category]

Request a list of Categories.

RETURNS DESCRIPTION
List[Category]

A list of categories.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_category_conditions(category_id: int) -> List[Condition]

Request a list of category Conditions.

RETURNS DESCRIPTION
List[Condition]

A list of category conditions.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_category_groups(category_id: int) -> List[Group]

Request a list of category Groups.

RETURNS DESCRIPTION
List[Group]

A list of category groups.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_category_languages(category_id: int) -> List[Language]

Request a list of category Languages.

RETURNS DESCRIPTION
List[Language]

A list of category languages.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_category_printings(category_id: int) -> List[Printing]

Request a list of category Printings.

RETURNS DESCRIPTION
List[Printing]

A list of category printings.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_category_rarities(category_id: int) -> List[Rarity]

Request a list of category Rarities.

RETURNS DESCRIPTION
List[Rarity]

A list of category rarities.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_group_prices(group_id: int) -> List[Price]

Request a list of group Prices.

RETURNS DESCRIPTION
List[Price]

A list of group prices.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

list_group_products(category_id: int, group_id: int) -> List[Product]

Request a list of group Products.

RETURNS DESCRIPTION
List[Product]

A list of group products.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

product(product_id: int) -> Product

Request data for a Product based on its id.

PARAMETER DESCRIPTION
product_id

The product id.

TYPE: int

RETURNS DESCRIPTION
Product

A product object.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.

product_prices(product_id: int) -> List[Price]

Request a list of product Prices.

RETURNS DESCRIPTION
List[Price]

A list of product prices.

RAISES DESCRIPTION
AuthenticationError

If TCGPlayer returns with an invalid authorization response.

ServiceError

If there is an issue with validating the response.