Scryfall Set Exporter
Python CLI — 119 lines, zero dependencies
Pythonstdlib onlyScryfall API
- Status
- Done — it does the one thing
- Stack
- Python 3, standard library only
- Code
- Local — happy to share it
Problem
Sometimes you just need a plain list of every card name in a Magic set
— to build a cube list, to feed a bulk search, to hand to another
script as input. Scryfall will give you that, but through a paginated
JSON API: you follow next_page until the set runs out, then
pull the names back out of the payload.
Doing that by hand is tedious enough to be worth automating, and every existing tool that automates it wants a package install, a virtualenv, and a dependency tree that will need attention in a year.
Solution
One Python file that imports nothing outside the standard library. Hand it a set code, get a text file.
python app.py neowritesneo_card_names.txt; run it with no arguments and it asks for the set code- Follows Scryfall’s pagination until the set is exhausted, so you get the whole set rather than the first page
- Unwraps Scryfall’s error payloads, so a typo’d set code gives you the API’s actual message instead of a stack trace
--include-duplicateskeeps every printing when a set has variants; by default the list collapses to unique names-oto name the output file, and a proper User-Agent header because Scryfall asks for one
Worth noting
Having no dependencies is the feature, not a shortcut. There is no
requirements.txt to resolve, no virtualenv to activate, and
nothing that breaks when a library publishes a major version. Copy the
file onto any machine with Python and it runs — which is the whole
reason it still works every time I reach for it.