-
Notifications
You must be signed in to change notification settings - Fork 1
/
card_list.py
44 lines (33 loc) · 1.25 KB
/
card_list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from flask import json, Flask
cardsHTML = ""
app = Flask(__name__)
@app.route('/')
def list_cards():
return cardsHTML
def get_cards():
global cardsHTML
with open('./cards.json', 'r') as cards:
card_json = json.load(cards)
cards = [
card_json['Basic'],
card_json['Classic'],
card_json['Hall of Fame'], # classic but no longer standard
card_json['Goblins vs Gnomes'],
card_json['Naxxramas'],
card_json['The Grand Tournament'],
card_json['Blackrock Mountain'],
card_json['The League of Explorers'],
card_json['Whispers of the Old Gods'],
card_json['Karazhan'],
card_json['Mean Streets of Gadgetzan'],
card_json['Journey to Un\'Goro'],
]
for set in cards:
for card in set:
if card['type'] not in ('Enchantment', 'Hero', 'Hero Power') and \
'collectible' in card and card['collectible'] is True:
cardsHTML += \
'<div style="float:left"><p>' + card['name'] + '</p><img src="' + card['img'] + '" /></div>'
if __name__ == "__main__":
get_cards()
app.run(debug=True, port=8000)