-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeckbrewAPI.py
More file actions
executable file
·36 lines (30 loc) · 863 Bytes
/
DeckbrewAPI.py
File metadata and controls
executable file
·36 lines (30 loc) · 863 Bytes
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
#!/usr/bin/env python
#####
# Deckbrew API Documentation: http://deckbrew.com/api/
#####
from urllib2 import urlopen
from urllib import quote, urlretrieve
from json import load, dumps
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
# key = "API_KEY"
multiverseID = str(45278)
url = 'http://api.deckbrew.com/mtg/cards'
url += '?m=' + multiverseID
response = urlopen(url)
json_obj = load(response)
for card in json_obj:
#print card.keys()
editions = card['editions']
#print type(editions)
#print len(editions)
for i,idx in enumerate(editions):
#print editions[i]
if type(editions[i]) == type({}):
print
print editions[i]['set']
print editions[i]['multiverse_id']
print str(editions[i]['image_url'])
print