commit
b45e4d13f3
|
@ -0,0 +1,26 @@
|
||||||
|
name: Python Tests
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [3.5, 3.6, 3.7, 3.8]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install pytest
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
- name: Test with pytest
|
||||||
|
run: |
|
||||||
|
pytest
|
|
@ -1,5 +1,13 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.8.0
|
||||||
|
|
||||||
|
Changes
|
||||||
|
- CI tests have now been added
|
||||||
|
- Bulk data uri method has been updated, with a deprecation warning for the previous method.
|
||||||
|
- `preview()` method has been added to all card methods.
|
||||||
|
- Tests have been updated to reflect new changes.
|
||||||
|
|
||||||
## 1.7.1
|
## 1.7.1
|
||||||
New stuff
|
New stuff
|
||||||
- Added image uri compatability for adventure cards
|
- Added image uri compatability for adventure cards
|
||||||
|
|
|
@ -123,14 +123,7 @@ Returns the type of object the specified index is
|
||||||
### `bulk_permalink_uri()`
|
### `bulk_permalink_uri()`
|
||||||
|
|
||||||
```
|
```
|
||||||
The URL that hosts the bulk file
|
None
|
||||||
|
|
||||||
Args:
|
|
||||||
num (int): The index of the object in the `data` key
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
string: A URI to download the compressed data
|
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `bulk_type()`
|
### `bulk_type()`
|
||||||
|
@ -157,6 +150,19 @@ The time the item was last updated
|
||||||
Returns:
|
Returns:
|
||||||
string: Timestamp
|
string: Timestamp
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `bulk_uri()`
|
||||||
|
|
||||||
|
```
|
||||||
|
The URL that hosts the bulk file
|
||||||
|
|
||||||
|
Args:
|
||||||
|
num (int): The index of the object in the `data` key
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
string: A URI to download the compressed data
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `data()`
|
### `data()`
|
||||||
|
|
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
||||||
Returns:
|
Returns:
|
||||||
string
|
string
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `preview()`
|
||||||
|
|
||||||
|
```
|
||||||
|
Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `prices()`
|
### `prices()`
|
||||||
|
|
|
@ -429,6 +429,22 @@ The power of the creature, if applicable
|
||||||
Returns:
|
Returns:
|
||||||
string
|
string
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `preview()`
|
||||||
|
|
||||||
|
```
|
||||||
|
Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `prices()`
|
### `prices()`
|
||||||
|
|
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
||||||
Returns:
|
Returns:
|
||||||
string
|
string
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `preview()`
|
||||||
|
|
||||||
|
```
|
||||||
|
Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `prices()`
|
### `prices()`
|
||||||
|
|
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
||||||
Returns:
|
Returns:
|
||||||
string
|
string
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `preview()`
|
||||||
|
|
||||||
|
```
|
||||||
|
Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `prices()`
|
### `prices()`
|
||||||
|
|
|
@ -432,6 +432,22 @@ The power of the creature, if applicable
|
||||||
Returns:
|
Returns:
|
||||||
string
|
string
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `preview()`
|
||||||
|
|
||||||
|
```
|
||||||
|
Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `prices()`
|
### `prices()`
|
||||||
|
|
|
@ -434,6 +434,22 @@ The power of the creature, if applicable
|
||||||
Returns:
|
Returns:
|
||||||
string
|
string
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `preview()`
|
||||||
|
|
||||||
|
```
|
||||||
|
Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `prices()`
|
### `prices()`
|
||||||
|
|
|
@ -430,6 +430,22 @@ The power of the creature, if applicable
|
||||||
Returns:
|
Returns:
|
||||||
string
|
string
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
### `preview()`
|
||||||
|
|
||||||
|
```
|
||||||
|
Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
### `prices()`
|
### `prices()`
|
||||||
|
|
|
@ -5,6 +5,7 @@ import asyncio
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
import warnings
|
||||||
|
|
||||||
class BulkData(FoundationObject):
|
class BulkData(FoundationObject):
|
||||||
"""
|
"""
|
||||||
|
@ -164,6 +165,10 @@ class BulkData(FoundationObject):
|
||||||
return self.scryfallJson['data'][num]['compressed_size']
|
return self.scryfallJson['data'][num]['compressed_size']
|
||||||
|
|
||||||
def bulk_permalink_uri(self, num):
|
def bulk_permalink_uri(self, num):
|
||||||
|
warnings.warn("This method has been renamed to bulk_uri as per https://scryfall.com/blog/updates-to-bulk-data-and-cards-deprecation-notice-217", DeprecationWarning)
|
||||||
|
return self.bulk_uri(num)
|
||||||
|
|
||||||
|
def bulk_uri(self, num):
|
||||||
"""The URL that hosts the bulk file
|
"""The URL that hosts the bulk file
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -172,9 +177,9 @@ class BulkData(FoundationObject):
|
||||||
Returns:
|
Returns:
|
||||||
string: A URI to download the compressed data
|
string: A URI to download the compressed data
|
||||||
"""
|
"""
|
||||||
super(BulkData, self)._checkForTupleKey('data', num, 'permalink_uri')
|
super(BulkData, self)._checkForTupleKey('data', num, 'uri')
|
||||||
|
|
||||||
return self.scryfallJson['data'][num]['permalink_uri']
|
return self.scryfallJson['data'][num]['uri']
|
||||||
|
|
||||||
def bulk_content_type(self, num):
|
def bulk_content_type(self, num):
|
||||||
"""The MIME type of the file
|
"""The MIME type of the file
|
||||||
|
|
|
@ -728,4 +728,23 @@ class CardsObject(FoundationObject):
|
||||||
"""
|
"""
|
||||||
super(CardsObject, self)._checkForKey('released_at')
|
super(CardsObject, self)._checkForKey('released_at')
|
||||||
|
|
||||||
return self.scryfallJson['released_at']
|
return self.scryfallJson['released_at']
|
||||||
|
|
||||||
|
def preview(self, key=None):
|
||||||
|
"""Preview information for this card, if any.
|
||||||
|
You may pass the name of a valid key to return the value of that key.
|
||||||
|
Such as a source_uri.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
key (string): A key for specific information about the preview.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict: If provided no key, the entire dict is returned.
|
||||||
|
string: If provided a key, the value of that key is returned.
|
||||||
|
"""
|
||||||
|
super(CardsObject, self)._checkForKey('preview')
|
||||||
|
|
||||||
|
if key in self.scryfallJson['preview']:
|
||||||
|
return self.scryfallJson['preview'][key]
|
||||||
|
|
||||||
|
return self.scryfallJson['preview']
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@ from setuptools import setup
|
||||||
setup(
|
setup(
|
||||||
name='scrython',
|
name='scrython',
|
||||||
packages=['scrython', 'scrython.cards', 'scrython.rulings', 'scrython.catalog', 'scrython.sets', 'scrython.symbology', 'scrython.bulk_data'],
|
packages=['scrython', 'scrython.cards', 'scrython.rulings', 'scrython.catalog', 'scrython.sets', 'scrython.symbology', 'scrython.bulk_data'],
|
||||||
version='1.7.1',
|
version='1.8.0',
|
||||||
description='A wrapper for using the Scryfall API.',
|
description='A wrapper for using the Scryfall API.',
|
||||||
long_description='https://github.com/NandaScott/Scrython/blob/master/README.md',
|
long_description='https://github.com/NandaScott/Scrython/blob/master/README.md',
|
||||||
url='https://github.com/NandaScott/Scrython',
|
url='https://github.com/NandaScott/Scrython',
|
||||||
|
|
|
@ -41,8 +41,8 @@ class TestBulk(unittest.TestCase):
|
||||||
self.assertIsInstance(bulk.bulk_compressed_size(0), int)
|
self.assertIsInstance(bulk.bulk_compressed_size(0), int)
|
||||||
self.assertIsInstance(bulk.bulk_compressed_size(0, True), str)
|
self.assertIsInstance(bulk.bulk_compressed_size(0, True), str)
|
||||||
|
|
||||||
def test_bulk_permalink_uri(self):
|
def test_bulk_uri(self):
|
||||||
self.assertIsInstance(bulk.bulk_permalink_uri(0), str)
|
self.assertIsInstance(bulk.bulk_uri(0), str)
|
||||||
|
|
||||||
def test_bulk_content_type(self):
|
def test_bulk_content_type(self):
|
||||||
self.assertIsInstance(bulk.bulk_content_type(0), str)
|
self.assertIsInstance(bulk.bulk_content_type(0), str)
|
|
@ -17,6 +17,7 @@ transform = Id(id='aae6fb12-b252-453b-bca7-1ea2a0d6c8dc'); time.sleep(0.1)
|
||||||
vanguard = Id(id='87c1234b-3834-4bba-bef2-05707bb1e8e2'); time.sleep(0.1)
|
vanguard = Id(id='87c1234b-3834-4bba-bef2-05707bb1e8e2'); time.sleep(0.1)
|
||||||
alt_lang_card = Collector(code='ths', collector_number='75', lang='ja'); time.sleep(0.1)
|
alt_lang_card = Collector(code='ths', collector_number='75', lang='ja'); time.sleep(0.1)
|
||||||
planeswalker = Id(id='4c565076-5db2-47ea-8ee0-4a4fd7bb353d'); time.sleep(0.1)
|
planeswalker = Id(id='4c565076-5db2-47ea-8ee0-4a4fd7bb353d'); time.sleep(0.1)
|
||||||
|
preview_check = Id(id='fb6b12e7-bb93-4eb6-bad1-b256a6ccff4e'); time.sleep(0.1)
|
||||||
|
|
||||||
autocomplete = Autocomplete(q='Thal'); time.sleep(0.1)
|
autocomplete = Autocomplete(q='Thal'); time.sleep(0.1)
|
||||||
|
|
||||||
|
@ -207,6 +208,10 @@ class TestCardObjects(unittest.TestCase):
|
||||||
def test_oversized(self):
|
def test_oversized(self):
|
||||||
self.assertIsInstance(non_online_card.oversized(), bool)
|
self.assertIsInstance(non_online_card.oversized(), bool)
|
||||||
|
|
||||||
|
def test_preview(self):
|
||||||
|
self.assertIsInstance(preview_check.preview(), dict)
|
||||||
|
self.assertIsInstance(preview_check.preview('source'), str)
|
||||||
|
|
||||||
class TestAutocomplete(unittest.TestCase):
|
class TestAutocomplete(unittest.TestCase):
|
||||||
|
|
||||||
def test_object(self):
|
def test_object(self):
|
Loading…
Reference in New Issue