Beispiel #1
0
async def background_task_spoiler_season():
    "Poll Scryfall for the latest 250 cards, and add them to our db if missing"
    await BOT.client.wait_until_ready()
    new_cards = fetcher.scryfall_cards()
    for c in new_cards['data']:
        try:
            oracle.valid_name(c['name'])
        except InvalidDataException:
            oracle.insert_scryfall_card(c)
            print('Imported {0} from Scryfall'.format(c['name']))
Beispiel #2
0
async def background_task_spoiler_season() -> None:
    'Poll Scryfall for the latest 250 cards, and add them to our db if missing'
    await BOT.client.wait_until_ready()
    new_cards = await fetcher.scryfall_cards_async()
    for c in new_cards['data']:
        try:
            oracle.valid_name(c['name'])
            await asyncio.sleep(1)
        except InvalidDataException:
            oracle.insert_scryfall_card(c, True)
            print('Imported {0} from Scryfall'.format(c['name']))
            await asyncio.sleep(5)
        except TooFewItemsException:
            pass