1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 15:02:59 +00:00
fftcgtool/fftcg/cards.py
2021-08-09 07:01:25 +02:00

24 lines
746 B
Python

import requests
from .card import Card
class Cards(list[Card]):
__API_URL = "https://fftcg.square-enix-games.com/de/get-cards"
def __init__(self, params: dict[str, any]):
# required params:
# text
# supported params:
# [str] text, language, code, multicard="○"|"", ex_burst="○"|"", special="《S》"|""
# [array] type, element, cost, rarity, power, category_1, set
# [int] exactmatch=0|1
if "text" not in params:
params["text"] = ""
req = requests.post(Cards.__API_URL, json=params)
super().__init__([Card(card_data) for card_data in req.json()["cards"]])
def __str__(self) -> str:
return "\n".join(str(card) for card in self)