Service

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

Wrapper to allow calling CardTrader API endpoints.

PARAMETER DESCRIPTION
access_token

User's access token to access CardTrader.

TYPE: str

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 CardTrader.

TYPE: Dict[str, str]

timeout

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

TYPE: int

cache

SQLiteCache to use if set.

TYPE: Optional[SQLiteCache]

Functions

blueprints(expansion_id: int) -> List[Blueprint]

Request a list of Blueprints in an Expansion.

PARAMETER DESCRIPTION
expansion_id

The expansion id.

TYPE: int

RETURNS DESCRIPTION
List[Blueprint]

A list of blueprints.

RAISES DESCRIPTION
AuthenticationError

If CardTrader returns with an invalid access token response.

ServiceError

If there is an issue with validating the response.

categories(game_id: Optional[int] = None) -> List[Category]

Request a list of Categories optionally filtered by Game.

PARAMETER DESCRIPTION
game_id

Optional filter by game_id.

TYPE: Optional[int] DEFAULT: None

RETURNS DESCRIPTION
List[Category]

A list of categories.

RAISES DESCRIPTION
AuthenticationError

If CardTrader returns with an invalid access token response.

ServiceError

If there is an issue with validating the response.

expansions() -> List[Expansion]

Request a list of Expansions.

RETURNS DESCRIPTION
List[Expansion]

A list of expansions.

RAISES DESCRIPTION
AuthenticationError

If CardTrader returns with an invalid access token response.

ServiceError

If there is an issue with validating the response.

games() -> List[Game]

Request a list of Games.

RETURNS DESCRIPTION
List[Game]

A list of games.

RAISES DESCRIPTION
AuthenticationError

If CardTrader returns with an invalid access token response.

ServiceError

If there is an issue with validating the response.

info() -> Info

Request information on your CardTrader account.

RETURNS DESCRIPTION
Info

An Info object.

RAISES DESCRIPTION
AuthenticationError

If CardTrader returns with an invalid access token response.

ServiceError

If there is an issue with validating the response.

products_by_blueprint(blueprint_id: int) -> List[Product]

Request a list of Products by blueprint.

PARAMETER DESCRIPTION
blueprint_id

The blueprint id.

TYPE: int

RETURNS DESCRIPTION
List[Product]

A list of products.

RAISES DESCRIPTION
AuthenticationError

If CardTrader returns with an invalid access token response.

ServiceError

If there is an issue with validating the response.

products_by_expansion(expansion_id: int) -> List[Product]

Request a list of Products by expansion.

PARAMETER DESCRIPTION
expansion_id

The expansion id.

TYPE: int

RETURNS DESCRIPTION
List[Product]

A list of products.

RAISES DESCRIPTION
AuthenticationError

If CardTrader returns with an invalid access token response.

ServiceError

If there is an issue with validating the response.