Skip to main content

A simple package to interact with the excellent EDHRec site for Magic the Gathering

Project description

PyEDHRec

Overview

This is a python wrapper around the excellent EDHREC website. Currently, EDHREC does not provide an API so the intent of this library is to enable people to build automated tooling around the useful information EDHREC provides.

Installation

This package is available on PyPI and can be installed with pip

pip install pyedhrec

Usage

Create an instance of the edhrec client

from edhrec import EDHRec


edhrec = EDHRec()

# Reference cards by the exact card name, the library will format as needed
miirym = "Miirym, Sentinel Wyrm"

# Get basic card details
details = edhrec.get_card_details(miirym)

# Get details for a list of cards
card_list = edhrec.get_card_list(["Pongify", "Farseek"])

# Get an edhrec.com link for a given card
miirym_link = edhrec.get_card_link(miirym)

# Get combos for a card
miirym_combos = edhrec.get_card_combos(miirym)

# Get commander data 
miirym_commander_data = edhrec.get_commander_data(miirym)

# Get cards commonly associated with a commander
miirym_cards = edhrec.get_commander_cards(miirym)

# Get the average decklist for a commander
miirym_avg_deck = edhrec.get_commanders_average_deck(miirym)

# Get known deck lists for a commander
miirym_decks = edhrec.get_commander_decks(miirym)

# This library provides several methods to get specific types of recommended cards
new_cards = edhrec.get_new_cards(miirym)
high_synergy_cards = edhrec.get_high_synergy_cards(miirym)

# Get all top cards
top_cards = edhrec.get_top_cards(miirym)

# Get specific top cards by type
top_creatures = edhrec.get_top_creatures(miirym)
top_instants = edhrec.get_top_instants(miirym)
top_sorceries = edhrec.get_top_sorceries(miirym)
top_enchantments = edhrec.get_top_enchantments(miirym)
top_artifacts = edhrec.get_top_artifacts(miirym)
top_mana_artifacts = edhrec.get_top_mana_artifacts(miirym)
top_battles = edhrec.get_top_battles(miirym)
top_planeswalkers = edhrec.get_top_planeswalkers(miirym)
top_utility_lands = edhrec.get_top_utility_lands(miirym)
top_lands = edhrec.get_top_lands(miirym)

Caching

To avoid excessive requests to edhrec.com this library uses in-memory caching for card retrieval methods. Each time you run a script using this library we'll cache the results for any given card. If you request the card again during the same execution we will use the cached value until the cache expires (defaults to 24 hours). If you use a long running script know that card data will only be updated once a day. Due to the nature of the game not changing often this should normally not cause issues and will help alleviate excessive traffic to EDHREC servers.

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

pyedhrec-0.0.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyedhrec-0.0.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pyedhrec-0.0.1.tar.gz.

File metadata

  • Download URL: pyedhrec-0.0.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pyedhrec-0.0.1.tar.gz
Algorithm Hash digest
SHA256 79258965ca3a15e86cc36e971593c5d276e8e9ab22926ab8811ffdcd3d196544
MD5 c49717220c595bafc91ec6c63b0734f5
BLAKE2b-256 3e9032a090a213635032d7ad7940fdde6b3e078b0c1e9035d49437ed2b4e87b2

See more details on using hashes here.

File details

Details for the file pyedhrec-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyedhrec-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pyedhrec-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a061ac47adaca71b9fcbea661f6d83172b390726e1bad38fe0dd832a205a57dd
MD5 25c8f43d6af27d522ece5ece8876935d
BLAKE2b-256 e933a30827143a0fdb887869cf2eb6ef8a6ea3d6914da60857ef7c7626822c01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page