def test_langs(self): lang = random.choice(list(gs.get_langs())) data['langs'] = { 'characters': gs.get_characters(uid, lang=lang), 'banner_types': gs.get_banner_types(lang=lang), 'wish_history': list(gs.get_wish_history(200, 20, lang=lang)), 'gacha_items': gs.get_gacha_items(lang=lang), 'banner_details': gs.get_banner_details("b8fd0d8a6c940c7a16a486367de5f6d2232f53", lang=lang), }
def test_langs(uid: int = 710785423): langs = gs.get_langs() lang = "de-de" characters = gs.get_characters(uid, lang=lang) for char in characters: if "Player" in char["icon"]: assert char["name"] == "Reisende" banner_types = gs.get_banner_types(lang=lang) assert banner_types[200] == "Standardgebet" history = list(gs.get_wish_history(200, size=20, lang=lang)) assert history[0]["banner"] == "Standardgebet" items = gs.get_gacha_items(lang=lang) assert items[0]["type"] == "Figur" details = gs.get_banner_details("b8fd0d8a6c940c7a16a486367de5f6d2232f53", lang=lang) assert details["banner"] == "Aktionsgebet „Balladen in Bechern“"
"""Calculates your pity for each banner""" import genshinstats as gs banners = gs.get_banner_types() for banner_type, banner_name in banners.items(): print('\n' + banner_name) since = 0 for pull in gs.get_wish_history(banner_type): since += 1 if pull['rarity'] == 5: print(f"{since} pulls since 5*, {90-since} until pity") break else: print( f"Pulled a 5* a long time ago or never, less than {90-since} until pity" )
def test_wish_history(): wish_history = list(gs.get_wish_history(size=20)) assert len(wish_history) == 20
def test_authkey_param(): authkey = gs.extract_authkey(gs.wishes._read_logfile()) wish_history = list(gs.get_wish_history(200, size=20, authkey=authkey))
def test_wish_history(self): data['wish_history'] = list(gs.get_wish_history(size=60))
import csv import genshinstats as gs with open("export.csv", "w", newline="", encoding="utf-8") as file: fieldnames = ["time", "name", "type", "rarity", "banner"] writer = csv.DictWriter(file, fieldnames, extrasaction="ignore") writer.writeheader() print("preparing data...", end="\r") for i, pull in enumerate(gs.get_wish_history()): print(f"fetched {i} pulls", end="\r") writer.writerow(pull)