Skip to main content

Fetches MTG card price info from scryfall.com

Project description

sf_price_fetcher

Simple Python API to pull pricing information from scryfall.com.

Provides caching of prices via an sqlite3 database.

NOTE that currently (as of v.0.1), the cache expiry time is set to 1 week. This will change and become configurable in future versions.

Usage

Typical usage is quite straightforward:

>>> from sf_price_fetcher import fetcher
>>> fetcher.get('mox amber')
'29.98'

sf_price_fetcher returns the lowest USD price for any printing of that card which is not from a promotional set.

CLI

sf_price_fetcher also includes a command-line interface. For syntax information:

$ python -m sf_price_fetcher --help
usage: __main__.py [-h] [-c] [-s] card_name

Card price fetcher for scryfall.com

positional arguments:
  card_name

optional arguments:
  -h, --help    show this help message and exit
  -c, --card    Print full card data instead of just the price.
  -s, --search  Search for the card name and return all unique printings.

Usage examples:

$ python -m sf_price_fetcher faerie\ vandal
faerie vandal: $0.07
$ python -m sf_price_fetcher "black lotus"
black lotus: $8499.99

The -c and -s options are primarily used for debugging. They output the full JSON data pulled from scryfall.

$ python -m sf_price_fetcher -c 'blacker lotus' | head
{'object': 'card',
 'id': '4c85d097-e87b-41ee-93c6-0e54ec41b174',
 'oracle_id': '41dd29b9-f08d-4ccc-8dc0-da11d2d456e9',
 'multiverse_ids': [9764],
 'tcgplayer_id': 830,
 'cardmarket_id': 11870,
 'name': 'Blacker Lotus',
 'lang': 'en',
 'released_at': '1998-08-11',
 'uri': 'https://api.scryfall.com/cards/4c85d097-e87b-41ee-93c6-0e54ec41b174',

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

sf_price_fetcher-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

sf_price_fetcher-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file sf_price_fetcher-0.1.0.tar.gz.

File metadata

  • Download URL: sf_price_fetcher-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for sf_price_fetcher-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed9af0637e3f97098c5502a9993d4382237724433da89fb8b008bafb5d81957f
MD5 e9abbd14f76c06226c47ee8f952c5a64
BLAKE2b-256 fb626e5ba2e914462d1685af99fcb8e24c9776a832fa6167b6b352bb4682bd4f

See more details on using hashes here.

File details

Details for the file sf_price_fetcher-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sf_price_fetcher-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for sf_price_fetcher-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a17451baa36e469c517f4f902ba4af770a8646b0af5343150c48dd6dc7b1e813
MD5 4a03c2dcff4a15843074c021116dc278
BLAKE2b-256 4119bf3b2fce8432867f7d1bcea7b1b1cbfec667deeda870353a9d247bac3351

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page