Removed docstring and created real docs.
This commit is contained in:
		
							parent
							
								
									9270d6a959
								
							
						
					
					
						commit
						287eb203a6
					
				| 
						 | 
				
			
			@ -2,60 +2,6 @@ import aiohttp
 | 
			
		|||
import asyncio
 | 
			
		||||
 | 
			
		||||
class ScryfallObject(object):
 | 
			
		||||
	"""
 | 
			
		||||
	Parameters:
 | 
			
		||||
		format: str				The data format to return: json, text, or image. Defaults to json.
 | 
			
		||||
		face: str				If using the image format and this parameter has the value back,
 | 
			
		||||
									the back face of the card will be returned.
 | 
			
		||||
									Will return a 404 if this card has no back face.
 | 
			
		||||
		version: str			The image version to return when using the image
 | 
			
		||||
									format: small, normal, large, png, art_crop, or border_crop. Defaults to large.
 | 
			
		||||
		pretty: bool			If true, the returned JSON will be prettified. Avoid using for production code.
 | 
			
		||||
 | 
			
		||||
	Attributes:
 | 
			
		||||
		object: str				Returns the type of object it is. (card, error, etc)
 | 
			
		||||
		id: str					The scryfall id of the card.
 | 
			
		||||
		multiverse_ids: arr		The associated multiverse ids of the card.
 | 
			
		||||
		mtgo_id: int			The Magic Online id of the card.
 | 
			
		||||
		mtgo_foil_id: int		The Magic Online foil id of the card.
 | 
			
		||||
		name: str				The full name of the card. Cards with multiple faces are named with '//' as a seperator.
 | 
			
		||||
		uri: str				The Scryfall API uri for the card.
 | 
			
		||||
		scryfall_uri: str		The full Scryfall page of the card.
 | 
			
		||||
		layout: str				The image layout of the card. (normal, transform, etc)
 | 
			
		||||
		highres_image: bool		Returns True if the card has a high res image.
 | 
			
		||||
		card_image_uris: dict	All image uris of the card in various qualities.
 | 
			
		||||
		cmc: float				A float of the converted mana cost of the card.
 | 
			
		||||
		type_line: str			The full type line of the card.
 | 
			
		||||
		oracle_text: str		The official oracle text of a card.
 | 
			
		||||
		mana_cost: str			The full mana cost using shorthanded mana symbols.
 | 
			
		||||
		colors: arr				An array of strings with all colors found in the mana cost.
 | 
			
		||||
		color_identity: arr		An array of strings with all colors found on the card itself.
 | 
			
		||||
		legalities: dict		A dictionary of all formats and their legality.
 | 
			
		||||
		reserved: bool			Returns True if the card is on the reserved list.
 | 
			
		||||
		reprint: bool			Returns True if the card has been reprinted before.
 | 
			
		||||
		set: str				The 3 letter code for the set of the card.
 | 
			
		||||
		set_name: str			The full name for the set of the card.
 | 
			
		||||
		set_uri: str			The API uri for the full set list of the card.
 | 
			
		||||
		set_search_uri: str		Same output as set_uri.
 | 
			
		||||
		scryfall_set_uri: str	The full link to the set on Scryfall.
 | 
			
		||||
		rulings_uri: str		The API uri for the rulings of the card.
 | 
			
		||||
		prints_search_uri: str	A link to where you can begin paginating all re/prints for this card on Scryfall’s API.
 | 
			
		||||
		collector_number: str	The collector number of the card.
 | 
			
		||||
		digital: bool			Returns True if the card is the digital version.
 | 
			
		||||
		rarity: str				The rarity of the card.
 | 
			
		||||
		illustration_id: str	The related id of the card art.
 | 
			
		||||
		artist: str				The artist of the card.
 | 
			
		||||
		frame: str				The year of the card frame.
 | 
			
		||||
		full_art: bool			Returns True if the card is considered full art.
 | 
			
		||||
		border_color: str		The color of the card border.
 | 
			
		||||
		timeshifted: bool		Returns True if the card is timeshifted.
 | 
			
		||||
		colorshifted: bool		Returns True if the card is colorshifted.
 | 
			
		||||
		futureshifted: bool		Returns True if the card is futureshifted.
 | 
			
		||||
		edhrec_rank: int		The rank of the card on edhrec.com
 | 
			
		||||
		tix: int				The MTGO price of the card
 | 
			
		||||
		related_uris: dict		A dictionary of related websites for this card.
 | 
			
		||||
		purchase_uris: dict		A dictionary of links to purchase the card.
 | 
			
		||||
	"""
 | 
			
		||||
	def __init__(self, _url, **kwargs):
 | 
			
		||||
		self._url = 'https://api.scryfall.com/' + _url
 | 
			
		||||
		loop = asyncio.get_event_loop()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,111 @@
 | 
			
		|||
# Cards
 | 
			
		||||
Documentation for a card object. These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
 | 
			
		||||
 | 
			
		||||
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`card.scryfallJson`).
 | 
			
		||||
 | 
			
		||||
## Attributes
 | 
			
		||||
All attributes are listed assuming the following
 | 
			
		||||
`card = scrython.cards.<Class>()` is the current usage.
 | 
			
		||||
 | 
			
		||||
## `card.object()`
 | 
			
		||||
str | Returns the type of object it is. (card, error, etc)
 | 
			
		||||
## `card.id()`
 | 
			
		||||
str | The scryfall id of the card.
 | 
			
		||||
## `card.multiverse_ids()`
 | 
			
		||||
arr | The associated multiverse ids of the card.
 | 
			
		||||
## `card.mtgo_id()`
 | 
			
		||||
int | The Magic Online id of the card.
 | 
			
		||||
## `card.mtgo_foil_id()`
 | 
			
		||||
int | The Magic Online foil id of the card.
 | 
			
		||||
## `card.name()`
 | 
			
		||||
str | The full name of the card. Cards with multiple faces are named with '//' as a seperator.
 | 
			
		||||
## `card.uri()`
 | 
			
		||||
str | The Scryfall API uri for the card.
 | 
			
		||||
## `card.scryfall_uri()`
 | 
			
		||||
str | The full Scryfall page of the card.
 | 
			
		||||
## `card.layout()`
 | 
			
		||||
str | The image layout of the card. (normal, transform, etc)
 | 
			
		||||
## `card.highres_image()`
 | 
			
		||||
bool | Returns True if the card has a high res image.
 | 
			
		||||
## `card.image_uris()`
 | 
			
		||||
dict | All image uris of the card in various qualities.
 | 
			
		||||
## `card.cmc()`
 | 
			
		||||
float | A float of the converted mana cost of the card.
 | 
			
		||||
## `card.type_line()`
 | 
			
		||||
str | The full type line of the card.
 | 
			
		||||
## `card.oracle_text()`
 | 
			
		||||
str | The official oracle text of a card.
 | 
			
		||||
## `card.mana_cost()`
 | 
			
		||||
str | The full mana cost using shorthanded mana symbols.
 | 
			
		||||
## `card.colors()`
 | 
			
		||||
arr | An array of strings with all colors found in the mana cost.
 | 
			
		||||
## `card.color_identity()`
 | 
			
		||||
arr | An array of strings with all colors found on the card itself.
 | 
			
		||||
## `card.legalities()`
 | 
			
		||||
dict | A dictionary of all formats and their legality.
 | 
			
		||||
## `card.reserved()`
 | 
			
		||||
bool | Returns True if the card is on the reserved list.
 | 
			
		||||
## `card.reprint()`
 | 
			
		||||
bool | Returns True if the card has been reprinted before.
 | 
			
		||||
## `card.set()`
 | 
			
		||||
str | The 3 letter code for the set of the card.
 | 
			
		||||
## `card.set_name()`
 | 
			
		||||
str | The full name for the set of the card.
 | 
			
		||||
## `card.set_uri()`
 | 
			
		||||
str | The API uri for the full set list of the card.
 | 
			
		||||
## `card.set_search_uri()`
 | 
			
		||||
str | Same output as set_uri.
 | 
			
		||||
## `card.scryfall_set_uri()`
 | 
			
		||||
str | The full link to the set on Scryfall.
 | 
			
		||||
## `card.rulings_uri()`
 | 
			
		||||
str | The API uri for the rulings of the card.
 | 
			
		||||
## `card.prints_search_uri()`
 | 
			
		||||
str | A link to where you can begin paginating all re/prints for this card on Scryfall’s API.
 | 
			
		||||
## `card.collector_number()`
 | 
			
		||||
str | The collector number of the card.
 | 
			
		||||
## `card.digital()`
 | 
			
		||||
bool | Returns True if the card is the digital version.
 | 
			
		||||
## `card.rarity()`
 | 
			
		||||
str | The rarity of the card.
 | 
			
		||||
## `card.illustration_id()`
 | 
			
		||||
str | The related id of the card art.
 | 
			
		||||
## `card.artist()`
 | 
			
		||||
str | The artist of the card.
 | 
			
		||||
## `card.frame()`
 | 
			
		||||
str | The year of the card frame.
 | 
			
		||||
## `card.full_art()`
 | 
			
		||||
bool | Returns True if the card is considered full art.
 | 
			
		||||
## `card.border_color()`
 | 
			
		||||
str | The color of the card border.
 | 
			
		||||
## `card.timeshifted()`
 | 
			
		||||
bool | Returns True if the card is timeshifted.
 | 
			
		||||
## `card.colorshifted()`
 | 
			
		||||
bool | Returns True if the card is colorshifted.
 | 
			
		||||
## `card.futureshifted()`
 | 
			
		||||
bool | Returns True if the card is futureshifted.
 | 
			
		||||
## `card.edhrec_rank()`
 | 
			
		||||
int | The rank of the card on edhrec.com
 | 
			
		||||
## `card.currency("<mode>")`
 | 
			
		||||
str |  Takes an argument for a currency, then returns a string of that value. (`currency("usd")>>"1.35"`). Current modes are `usd`, `eur`, and `tix`.
 | 
			
		||||
## `card.related_uris()`
 | 
			
		||||
dict | A dictionary of related websites for this card.
 | 
			
		||||
## `card.purchase_uris()`
 | 
			
		||||
dict | A dictionary of links to purchase the card.
 | 
			
		||||
## `card.life_modifier()`
 | 
			
		||||
str | This is the cards life modifier value, assuming it's a Vanguard card.
 | 
			
		||||
## `card.hand_modifier()`
 | 
			
		||||
str | This cards hand modifier value, assuming it's a Vanguard card.
 | 
			
		||||
## `card.color_indicator()`
 | 
			
		||||
arr | An array of all colors found in this card's color indicator.
 | 
			
		||||
## `card.all_parts()`
 | 
			
		||||
arr | This this card is closely related to other cards, this property will be an array with it.
 | 
			
		||||
## `card.card_faces()`
 | 
			
		||||
arr | If it exists, all parts found on a card's face will be found as an object from this array.
 | 
			
		||||
## `card.watermark()`
 | 
			
		||||
str | The associated watermark of the card, if any.
 | 
			
		||||
## `card.story_spotlight_number()`
 | 
			
		||||
int | This card's story spotlight number, if any.
 | 
			
		||||
## `card.story_spotlight_uri()`
 | 
			
		||||
str | The URI for the card's story article, if any.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
# Scrython
 | 
			
		||||
Scrython is a wrapper for the Scryfall API, designed for an easier use. Make sure to familiarize yourself with the docs.
 | 
			
		||||
## Breaking changes
 | 
			
		||||
Since Scryfall's API is constantly changing, this library will also be changing.
 | 
			
		||||
 | 
			
		||||
Versions will be broken down as such:
 | 
			
		||||
 | 
			
		||||
0: Overall library version
 | 
			
		||||
0.x: Changes that will break previous functionality
 | 
			
		||||
0.x.x: Changes that Scryfall has made to break functionality.
 | 
			
		||||
 | 
			
		||||
It's important to keep up to date with library changes, since it relies on how Scryfall has updated it's own API. If they change something, my library will potentially break or be outdated until a fix is patched.
 | 
			
		||||
 | 
			
		||||
## Basic usage
 | 
			
		||||
Scrython can be imported using `import scrython` at the top of your code.
 | 
			
		||||
I've written to library to attempt to be familiar for those who already use it. As such, modules like `cards` are named to reflect the endpoints found in `api.scryfall.com/cards/`and so on.
 | 
			
		||||
For the most part I've kept all the class attributes the same as their key names, except for a few cases where I've found better functionality.
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
    >>>import scrython
 | 
			
		||||
    >>>card = scrython.cards.Named(fuzzy="Black Lotus")
 | 
			
		||||
    >>>card.name()
 | 
			
		||||
    'Black Lotus'
 | 
			
		||||
    >>>card.id()
 | 
			
		||||
    '*Remember to paste black lotus id*'
 | 
			
		||||
    >>>card.oracle_text()
 | 
			
		||||
    '{T}, Sacrifice Black Lotus: Add three mana of any one color to your mana pool.'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Key features
 | 
			
		||||
 | 
			
		||||
 - Asyncronous requests. This library utilizes the `asyncio` and `aiohttp` libraries to ensure that requests are not blocked when used in asyncronous environments. There is no delay limiting when making a request, so be careful how many objects are created.
 | 
			
		||||
 - Full use of all endpoints in a given category. This library uses every endpoint within `cards` and `rulings`as of writing this. I hope to include more as this is developed.
 | 
			
		||||
		Loading…
	
		Reference in New Issue