How to use the scrython.ScryfallError function in scrython

To help you get started, we’ve selected a few scrython examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NandaScott / Scrython / examples / handle_errors.py View on Github external
import scrython

# oops, we asked for an exact match to a card, but failed to put the name in quotes
# that's going to throw a Scryfall error
try:
    search = scrython.cards.Search(q="!Black Lotus")
except scrython.ScryfallError as e:
    print(str(e.error_details['status']) + ' ' + e.error_details['code'] + ': ' + e.error_details['details'])