Exemple #1
0
        card_tag = price_data["print_tag"]
        card_rarity = price_data["rarity"]

        prices = price_data["price_data"]["data"]["prices"]
        card_high = prices["high"]
        card_low = prices["low"]
        card_avg = prices["average"]

        new_card_quantity[card_tag] = 1

        print(card_name, ": ", card_high, card_avg, card_low)

        new_card = Card()
        new_card.name = card_name
        new_card.tag = card_tag
        new_card.box_name = box_name
        new_card.rarity = card_rarity
        new_card.price = card_low
        new_card.get_card_data()

        new_card_list.append(new_card)

    else:
        print("Invalid Response. Re-enter tag.")

inventory_input_file = open(inventory_input_filename, "r", newline="")
csv_reader = csv.DictReader(inventory_input_file)

inventory_output_file = open(
    "/Users/jacob/Documents/Online Trading Card Store/updated_inventory_list.csv",
    "w",
print("Importing Cards...")
card_list = []

input_file = open(
    inventory_input_filename,
    "r",
    newline="",
)

csv_reader = csv.DictReader(input_file)

for row in csv_reader:
    new_card = Card()
    new_card.name = row["Card Name"]
    new_card.tag = row["Tag"]
    new_card.box_name = row["Box Name"]
    new_card.rarity = row["Rarity"]
    new_card.price = row["Low"]
    new_card.quantity = row["Quantity"]

    new_card.get_card_data()

    card_list.append(new_card)
    print("Imported " + new_card.name)
    time.sleep(0.5)

output_file = open(
    "/Users/jacob/Documents/Online Trading Card Store/shopify_product_list.csv",
    "w",
    newline="",
)