Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

50%
+0 −0
Q&A How to automatically get the release date of the latest Magic: The Gathering Standard set?

I’m building a tool to check Magic: The Gathering deck legality in custom formats and want to update my formats with the same frequency as the Penny Dreadful format. Penny Dreadful updates when a n...

1 answer  ·  posted 11mo ago by ShadowsRanger‭  ·  edited 11mo ago by ShadowsRanger‭

Question python
#2: Post edited by user avatar ShadowsRanger‭ · 2025-10-23T22:08:35Z (11 months ago)
  • I’m building a tool to check Magic: The Gathering deck legality in custom formats. I want to update the formats automatically whenever a new Standard-legal set releases.
  • Is there a programmatic way to fetch the release date of the latest Standard set, ideally via an API or a reliable data source?
  • Some sample code of what I'd like to do:
  • ```python
  • import requests
  • import json
  • import os
  • LAST_UPDATED_FILE = "last_updated.json"
  • SCRYFALL_SETS_API = "https://api.scryfall.com/sets"
  • def fetch_sets_data():
  • """Fetch data from Scryfall sets API."""
  • response = requests.get(SCRYFALL_SETS_API)
  • response.raise_for_status()
  • return response.json()
  • def load_saved_updated_at(file_path=LAST_UPDATED_FILE):
  • """Load previously saved updated_at from file."""
  • if os.path.exists(file_path):
  • with open(file_path, "r") as f:
  • data = json.load(f)
  • return data.get("updated_at")
  • return None
  • def save_updated_at(updated_at, file_path=LAST_UPDATED_FILE):
  • """Save updated_at to file."""
  • with open(file_path, "w") as f:
  • json.dump({"updated_at": updated_at}, f)
  • def check_for_update(latest_updated_at, saved_updated_at):
  • """Return True if update detected, else False. Print 'updating' if True."""
  • if saved_updated_at is None or latest_updated_at > saved_updated_at:
  • save_updated_at(latest_updated_at)
  • return True
  • return False
  • def main():
  • data = fetch_sets_data()
  • latest_updated_at = data.get("updated_at") # hypothetical field
  • saved_updated_at = load_saved_updated_at()
  • if check_for_update(latest_updated_at, saved_updated_at):
  • print(Updating)
  • if __name__ == "__main__":
  • main()
  • ```
  • I’m building a tool to check Magic: The Gathering deck legality in custom formats and want to update my formats with the same frequency as the Penny Dreadful format. Penny Dreadful updates when a new Standard-legal set is released but typically ignores smaller supplemental sets.
  • Is there a programmatic way to fetch the release date of the latest Standard set, ideally via an API or a reliable data source?
#1: Initial revision by user avatar ShadowsRanger‭ · 2025-10-23T21:27:29Z (11 months ago)
How to automatically get the release date of the latest Magic: The Gathering Standard set?
I’m building a tool to check Magic: The Gathering deck legality in custom formats. I want to update the formats automatically whenever a new Standard-legal set releases.

Is there a programmatic way to fetch the release date of the latest Standard set, ideally via an API or a reliable data source?

Some sample code of what I'd like to do:

```python
import requests
import json
import os

LAST_UPDATED_FILE = "last_updated.json"
SCRYFALL_SETS_API = "https://api.scryfall.com/sets"


def fetch_sets_data():
    """Fetch data from Scryfall sets API."""
    response = requests.get(SCRYFALL_SETS_API)
    response.raise_for_status()
    return response.json()


def load_saved_updated_at(file_path=LAST_UPDATED_FILE):
    """Load previously saved updated_at from file."""
    if os.path.exists(file_path):
        with open(file_path, "r") as f:
            data = json.load(f)
            return data.get("updated_at")
    return None


def save_updated_at(updated_at, file_path=LAST_UPDATED_FILE):
    """Save updated_at to file."""
    with open(file_path, "w") as f:
        json.dump({"updated_at": updated_at}, f)


def check_for_update(latest_updated_at, saved_updated_at):
    """Return True if update detected, else False. Print 'updating' if True."""
    if saved_updated_at is None or latest_updated_at > saved_updated_at:
        save_updated_at(latest_updated_at)
        return True
    return False


def main():
    data = fetch_sets_data()
    latest_updated_at = data.get("updated_at")  # hypothetical field
    saved_updated_at = load_saved_updated_at()
    if check_for_update(latest_updated_at, saved_updated_at):
        print(Updating)


if __name__ == "__main__":
    main()

```