Pythonic wrapper around Valve's Artifact API
Project description
pyArtifact
Pythonic wrapper around Valve's Artifact API, with object mapping, filtering and hopefully more
Current phase: prototype -> very unstable API
Here's what we can do so far
>>> from pyartifact import Cards
>>> cards = Cards()
>>> cards.load_all_sets()
>>> repr(cards.get('Storm Spirit').includes[0])
<Artifact card: {'id': 10538, 'base_id': 10538, 'name': 'Ball Lightning', 'type': 'Spell', 'text': "Move an <span style='font-weight:bold;color:#736e80;'>allied black hero</span> to an empty combat position in any lane.", 'mini_image': 'https://steamcdn-a.akamaihd.net/apps/583950/icons/set01/10538.aeb7a6a47e1d8b1a26307ae25e329df3e3bb0843.png', 'large_image': 'https://steamcdn-a.akamaihd.net/apps/583950/icons/set01/10538_large_english.9b39d2d2bb4769b68fa3ac42abee35b1685a57de.png', 'ingame_image': None, '_CardBase__references': [], 'color': 'black', 'rarity': None, 'item_def': None, 'mana_cost': 3, 'illustrator': 'JiHun Lee'}>
>>> filtered = cards.filter.type('Spell').mana_cost(gt=4).color('black').rarity('Rare')
>>> len(filtered)
1
>>> for card in filtered:
... print(card)
...
The Cover of Night
# Deck encoding (wrapper not done)
>>> from pyartifact import decode_deck_string
>>> deck_contents = decode_deck_string('ADCJQUQI30zuwEYg2ABeF1Bu94BmWIBTEkLtAKlAZakAYmHh0JsdWUvUmVkIEV4YW1wbGU_')
>>> print(deck_contents['name'])
Blue/Red Example
>>> print(deck_contents['heroes'])
[{'id': 4003, 'turn': 1}, {'id': 10006, 'turn': 1}, {'id': 10030, 'turn': 1}, {'id': 10033, 'turn': 3}, {'id': 10065, 'turn': 2}]
>>> from pyartifact import encode_deck
>>> print(encode_deck(deck_contents))
ADCJQUQI30zuwEYg2ABeF1Bu94BmWIBTEkLtAKlAZakAYmHh0JsdWUvUmVkIEV4YW1wbGU_
Plans
- Wrap deck code API
- Provide text sanitizers (text atm. has html) - to markdown, strip, etc., use for deck encoding/decoding
- Add more filtering options
- Cleanup code structure (possible performance improvements)
- Write documentation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyArtifact-0.2.0.tar.gz
(13.6 kB
view hashes)
Built Distribution
pyArtifact-0.2.0-py3-none-any.whl
(55.5 kB
view hashes)
Close
Hashes for pyArtifact-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61dc5de2a89e462277977ced8fe07b461114c462cf590606f9b9a6a6b843b1fc |
|
MD5 | bfd3669e135f66f89e45a606f58003d8 |
|
BLAKE2b-256 | ea1a5c757fabb71907937f6eb3bdddf611ba5d9d8459c33e5675d3a6d8424b6e |