diff --git a/.idea/dictionaries/nanda.xml b/.idea/dictionaries/nanda.xml
new file mode 100644
index 0000000..a902a65
--- /dev/null
+++ b/.idea/dictionaries/nanda.xml
@@ -0,0 +1,15 @@
+
+
+
+ colorshifted
+ edhrec
+ futureshifted
+ highres
+ mana
+ mtgo
+ multiverse
+ scryfall
+ timeshifted
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..d34c0a8
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..65531ca
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..7535cb7
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/scrython.iml b/.idea/scrython.iml
new file mode 100644
index 0000000..6711606
--- /dev/null
+++ b/.idea/scrython.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..ab9295e
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,235 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Python
+
+
+
+
+ PyPep8Inspection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1516750438711
+
+
+ 1516750438711
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cards/named.py b/cards/named.py
index 542945e..ee667c2 100644
--- a/cards/named.py
+++ b/cards/named.py
@@ -1,5 +1,6 @@
-import asyncio, aiohttp
-import json
+import aiohttp
+import asyncio
+
class Named(object):
""" cards/named
@@ -79,13 +80,13 @@ class Named(object):
self.scryfallJson = loop.run_until_complete(getRequest(
url='https://api.scryfall.com/cards/named?',
params={
- 'exact':self.exact,
- 'fuzzy':self.fuzzy,
- 'set':self.set,
- 'format':self.format,
- 'face':self.face,
- 'version':self.version,
- 'pretty':self.pretty
+ 'exact': self.exact,
+ 'fuzzy': self.fuzzy,
+ 'set': self.set,
+ 'format': self.format,
+ 'face': self.face,
+ 'version': self.version,
+ 'pretty': self.pretty
}))
if self.scryfallJson['object'] == 'error':
diff --git a/cards/randomcard.py b/cards/randomcard.py
index c2624ed..e9bcad8 100644
--- a/cards/randomcard.py
+++ b/cards/randomcard.py
@@ -1,8 +1,9 @@
-import asyncio, aiohttp
-import json
+import aiohttp
+import asyncio
+
class RandomCard(object):
- """ cards/random
+ """ cards/random
Parameters:
format: str The data format to return: json, text, or image. Defaults to json.
@@ -58,158 +59,158 @@ class RandomCard(object):
purchase_uris: dict A dictionary of links to purchase the card.
"""
- def __init__(self, _format=None, face=None, version=None, pretty=None):
- self.format = _format
- self.face = face
- self.version = version
- self.pretty = pretty
- loop = asyncio.get_event_loop()
- self.session = aiohttp.ClientSession(loop=loop)
+ def __init__(self, **kwargs):
+ self.format = kwargs.get('format')
+ self.face = kwargs.get('face')
+ self.version = kwargs.get('version')
+ self.pretty = kwargs.get('pretty')
+ loop = asyncio.get_event_loop()
+ self.session = aiohttp.ClientSession(loop=loop)
- async def getRequest(url, **kwargs):
- async with self.session.get(url, **kwargs) as response:
- return await response.json()
+ async def getRequest(url, **kwargs):
+ async with self.session.get(url, **kwargs) as response:
+ return await response.json()
- self.scryfallJson = loop.run_until_complete(getRequest(
- url='https://api.scryfall.com/cards/random?',
- params={
- 'format':self.format,
- 'face':self.face,
- 'version':self.version,
- 'pretty':self.pretty
- }))
+ self.scryfallJson = loop.run_until_complete(getRequest(
+ url='https://api.scryfall.com/cards/random?',
+ params={
+ 'format': self.format,
+ 'face': self.face,
+ 'version': self.version,
+ 'pretty': self.pretty
+ }))
- if self.scryfallJson['object'] == 'error':
- raise Exception(self.scryfallJson['details'])
- self.session.close()
+ if self.scryfallJson['object'] == 'error':
+ raise Exception(self.scryfallJson['details'])
+ self.session.close()
- self.session.close()
+ self.session.close()
- def object(self):
- return self.scryfallJson['object']
+ def object(self):
+ return self.scryfallJson['object']
- def id(self):
- return self.scryfallJson['id']
+ def id(self):
+ return self.scryfallJson['id']
- def multiverse_ids(self):
- return self.scryfallJson['multiverse_ids']
+ def multiverse_ids(self):
+ return self.scryfallJson['multiverse_ids']
- def mtgo_id(self):
- return self.scryfallJson['mtgo_id']
+ def mtgo_id(self):
+ return self.scryfallJson['mtgo_id']
- def mtgo_foil_id(self):
- return self.scryfallJson['mtgo_foil_id']
+ def mtgo_foil_id(self):
+ return self.scryfallJson['mtgo_foil_id']
- def name(self):
- return self.scryfallJson['name']
+ def name(self):
+ return self.scryfallJson['name']
- def uri(self):
- return self.scryfallJson['uri']
+ def uri(self):
+ return self.scryfallJson['uri']
- def scryfall_uri(self):
- return self.scryfallJson['scryfall_uri']
+ def scryfall_uri(self):
+ return self.scryfallJson['scryfall_uri']
- def layout(self):
- return self.scryfallJson['layout']
+ def layout(self):
+ return self.scryfallJson['layout']
- def highres_image(self):
- return self.scryfallJson['highres_image']
+ def highres_image(self):
+ return self.scryfallJson['highres_image']
- def image_uris(self):
- return self.scryfallJson['image_uris']
+ def image_uris(self):
+ return self.scryfallJson['image_uris']
- def cmc(self):
- return self.scryfallJson['cmc']
+ def cmc(self):
+ return self.scryfallJson['cmc']
- def type_line(self):
- return self.scryfallJson['type_line']
+ def type_line(self):
+ return self.scryfallJson['type_line']
- def oracle_text(self):
- return self.scryfallJson['oracle_text']
+ def oracle_text(self):
+ return self.scryfallJson['oracle_text']
- def mana_cost(self):
- return self.scryfallJson['mana_cost']
+ def mana_cost(self):
+ return self.scryfallJson['mana_cost']
- def colors(self):
- return self.scryfallJson['colors']
+ def colors(self):
+ return self.scryfallJson['colors']
- def color_identity(self):
- return self.scryfallJson['color_identity']
+ def color_identity(self):
+ return self.scryfallJson['color_identity']
- def legalities(self):
- return self.scryfallJson['legalities']
+ def legalities(self):
+ return self.scryfallJson['legalities']
- def reserved(self):
- return self.scryfallJson['reserved']
+ def reserved(self):
+ return self.scryfallJson['reserved']
- def reprint(self):
- return self.scryfallJson['reprint']
+ def reprint(self):
+ return self.scryfallJson['reprint']
- def set(self):
- return self.scryfallJson['set']
+ def set(self):
+ return self.scryfallJson['set']
- def set_name(self):
- return self.scryfallJson['set_name']
+ def set_name(self):
+ return self.scryfallJson['set_name']
- def set_uri(self):
- return self.scryfallJson['set_uri']
+ def set_uri(self):
+ return self.scryfallJson['set_uri']
- def set_search_uri(self):
- return self.scryfallJson['set_search_uri']
+ def set_search_uri(self):
+ return self.scryfallJson['set_search_uri']
- def scryfall_set_uri(self):
- return self.scryfallJson['scryfall_set_uri']
+ def scryfall_set_uri(self):
+ return self.scryfallJson['scryfall_set_uri']
- def rulings_uri(self):
- return self.scryfallJson['rulings_uri']
+ def rulings_uri(self):
+ return self.scryfallJson['rulings_uri']
- def prints_search_uri(self):
- return self.scryfallJson['prints_search_uri']
+ def prints_search_uri(self):
+ return self.scryfallJson['prints_search_uri']
- def collector_number(self):
- return self.scryfallJson['collector_number']
+ def collector_number(self):
+ return self.scryfallJson['collector_number']
- def digital(self):
- return self.scryfallJson['digital']
+ def digital(self):
+ return self.scryfallJson['digital']
- def rarity(self):
- return self.scryfallJson['rarity']
+ def rarity(self):
+ return self.scryfallJson['rarity']
- def illustration_id(self):
- return self.scryfallJson['illustration_id']
+ def illustration_id(self):
+ return self.scryfallJson['illustration_id']
- def artist(self):
- return self.scryfallJson['artist']
+ def artist(self):
+ return self.scryfallJson['artist']
- def frame(self):
- return self.scryfallJson['frame']
+ def frame(self):
+ return self.scryfallJson['frame']
- def full_art(self):
- return self.scryfallJson['full_art']
+ def full_art(self):
+ return self.scryfallJson['full_art']
- def border_color(self):
- return self.scryfallJson['border_color']
+ def border_color(self):
+ return self.scryfallJson['border_color']
- def timeshifted(self):
- return self.scryfallJson['timeshifted']
+ def timeshifted(self):
+ return self.scryfallJson['timeshifted']
- def colorshifted(self):
- return self.scryfallJson['colorshifted']
+ def colorshifted(self):
+ return self.scryfallJson['colorshifted']
- def futureshifted(self):
- return self.scryfallJson['futureshifted']
+ def futureshifted(self):
+ return self.scryfallJson['futureshifted']
- def edhrec_rank(self):
- return self.scryfallJson['edhrec_rank']
+ def edhrec_rank(self):
+ return self.scryfallJson['edhrec_rank']
- def currency(self, mode):
- modes = ['usd', 'eur', 'tix']
- if mode not in modes:
- return KeyError("That currency is not available.")
- return self.scryfallJson[mode]
+ def currency(self, mode):
+ modes = ['usd', 'eur', 'tix']
+ if mode not in modes:
+ return KeyError("That currency is not available.")
+ return self.scryfallJson[mode]
- def related_uris(self):
- return self.scryfallJson['related_uris']
+ def related_uris(self):
+ return self.scryfallJson['related_uris']
- def purchase_uris(self):
- return self.scryfallJson['purchase_uris']
+ def purchase_uris(self):
+ return self.scryfallJson['purchase_uris']
diff --git a/cards/scryfall_object.py b/cards/scryfall_object.py
new file mode 100644
index 0000000..d9beab5
--- /dev/null
+++ b/cards/scryfall_object.py
@@ -0,0 +1,146 @@
+import aiohttp
+import asyncio
+
+
+class ScryfallObject(object):
+ """docstring for ScryfallObject."""
+ def __init__(self, **kwargs):
+ self.format = kwargs.get('format')
+ self.face = kwargs.get('face')
+ self.version = kwargs.get('version')
+ self.pretty = kwargs.get('pretty')
+ loop = asyncio.get_event_loop()
+ self.session = aiohttp.ClientSession(loop=loop)
+
+ async def getRequest(url, **kwargs):
+ async with self.session.get(url, **kwargs) as response:
+ return await response.json()
+
+ def object(self):
+ return self.scryfallJson['object']
+
+ def id(self):
+ return self.scryfallJson['id']
+
+ def multiverse_ids(self):
+ return self.scryfallJson['multiverse_ids']
+
+ def mtgo_id(self):
+ return self.scryfallJson['mtgo_id']
+
+ def mtgo_foil_id(self):
+ return self.scryfallJson['mtgo_foil_id']
+
+ def name(self):
+ return self.scryfallJson['name']
+
+ def uri(self):
+ return self.scryfallJson['uri']
+
+ def scryfall_uri(self):
+ return self.scryfallJson['scryfall_uri']
+
+ def layout(self):
+ return self.scryfallJson['layout']
+
+ def highres_image(self):
+ return self.scryfallJson['highres_image']
+
+ def image_uris(self):
+ return self.scryfallJson['image_uris']
+
+ def cmc(self):
+ return self.scryfallJson['cmc']
+
+ def type_line(self):
+ return self.scryfallJson['type_line']
+
+ def oracle_text(self):
+ return self.scryfallJson['oracle_text']
+
+ def mana_cost(self):
+ return self.scryfallJson['mana_cost']
+
+ def colors(self):
+ return self.scryfallJson['colors']
+
+ def color_identity(self):
+ return self.scryfallJson['color_identity']
+
+ def legalities(self):
+ return self.scryfallJson['legalities']
+
+ def reserved(self):
+ return self.scryfallJson['reserved']
+
+ def reprint(self):
+ return self.scryfallJson['reprint']
+
+ def set(self):
+ return self.scryfallJson['set']
+
+ def set_name(self):
+ return self.scryfallJson['set_name']
+
+ def set_uri(self):
+ return self.scryfallJson['set_uri']
+
+ def set_search_uri(self):
+ return self.scryfallJson['set_search_uri']
+
+ def scryfall_set_uri(self):
+ return self.scryfallJson['scryfall_set_uri']
+
+ def rulings_uri(self):
+ return self.scryfallJson['rulings_uri']
+
+ def prints_search_uri(self):
+ return self.scryfallJson['prints_search_uri']
+
+ def collector_number(self):
+ return self.scryfallJson['collector_number']
+
+ def digital(self):
+ return self.scryfallJson['digital']
+
+ def rarity(self):
+ return self.scryfallJson['rarity']
+
+ def illustration_id(self):
+ return self.scryfallJson['illustration_id']
+
+ def artist(self):
+ return self.scryfallJson['artist']
+
+ def frame(self):
+ return self.scryfallJson['frame']
+
+ def full_art(self):
+ return self.scryfallJson['full_art']
+
+ def border_color(self):
+ return self.scryfallJson['border_color']
+
+ def timeshifted(self):
+ return self.scryfallJson['timeshifted']
+
+ def colorshifted(self):
+ return self.scryfallJson['colorshifted']
+
+ def futureshifted(self):
+ return self.scryfallJson['futureshifted']
+
+ def edhrec_rank(self):
+ return self.scryfallJson['edhrec_rank']
+
+ def currency(self, mode):
+ modes = ['usd', 'eur', 'tix']
+ if mode not in modes:
+ return KeyError("That currency is not available.")
+ return self.scryfallJson[mode]
+
+ def related_uris(self):
+ return self.scryfallJson['related_uris']
+
+ def purchase_uris(self):
+ return self.scryfallJson['purchase_uris']
diff --git a/requirements.txt b/requirements.txt
index e84b373..c47b89f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,2 @@
+aiohttp
#Requirements for PyPI