示例#1
0
def main():
    print("Downloading all cards... Please be patient")

    fields_remain_same = [
        'id', 'name', 'national_pokedex_number', 'image_url',
        'image_url_hi_res', 'subtype', 'supertype', 'hp', 'number', 'artist',
        'rarity', 'series', 'set', 'set_code', 'converted_retreat_cost',
        'evolves_from'
    ]

    set_fields = [
        'total_cards', 'standard_legal', 'expanded_legal', 'release_date'
    ]

    cards = Card.all()
    sets = Set.all()

    create_workbook(cards, fields_remain_same, sets, set_fields)
示例#2
0
for s in Set.all():
    nset = et.SubElement(xmlsets, "set")

    name = et.SubElement(nset, "name")
    longname = et.SubElement(nset, "longname")
    setType = et.SubElement(nset, "setType")
    releasedate = et.SubElement(nset, "releasedate")

    name.text = s.code
    longname.text = s.name
    setType.text = s.series
    releasedate.text = s.release_date

names = []
n = 0
for c in Card.all():
    n += 1
    ncard = et.SubElement(xmlcards, "card")

    name = et.SubElement(ncard, "name")
    cset = et.SubElement(ncard, "set")
    color = et.SubElement(ncard, "color")
    mana = et.SubElement(ncard, "manacost")
    cmc = et.SubElement(ncard, "cmc")
    ctype = et.SubElement(ncard, "type")
    pt = et.SubElement(ncard, "pt")
    tablerow = et.SubElement(ncard, "tablerow")
    text = et.SubElement(ncard, "text")
    font = et.SubElement(ncard, "font")

    name.text = c.name + " " + c.id
示例#3
0
#! /usr/bin/env python

from pokemontcgsdk import Card
from pokemontcgsdk import Set
from pokemontcgsdk import Type
from pokemontcgsdk import Supertype
from pokemontcgsdk import Subtype
import json

#Gets all info needed
cards = Card.all()
sets = Set.all()
types = Type.all()
subtypes = Subtype.all()
supertypes = Supertype.all()

print('Resources gathered, converting to json...')

#Loops through all cards an eliminates all NoneTypes to eliminate excess null values in json
cards_list = []
for c in cards:
    card_dict = {}

    if c.id is not None:
        card_dict["id"] = c.id

    if c.name is not None:
        card_dict["name"] = c.name

    if c.national_pokedex_number is not None:
        card_dict["national_pokedex_number"] = c.national_pokedex_number