Utility Functions
utility
Utilities for genshin.py.
Modules:
-
auth–Auth utilities.
-
concurrency–Utilities for concurrency optimizations.
-
deprecation–Deprecation decorator.
-
ds–Dynamic secret generation.
-
extdb–External databases for Genshin Impact data.
-
fs–File system related utilities.
-
logfile–Search logfile for authkeys.
-
uid–Utility functions related to genshin.
Functions:
-
create_short_lang_code–Create an alternative short lang code.
-
encrypt_credentials–Encrypt text for geetest.
-
extract_authkey–Extract an authkey from the provided string.
-
generate_app_login_ds–Create a dynamic secret for app login.
-
generate_cn_dynamic_secret–Create a new chinese dynamic secret.
-
generate_dynamic_secret–Create a new overseas dynamic secret.
-
generate_geetest_ds–Create a dynamic secret for geetest API endpoint.
-
generate_passport_ds–Create a dynamic secret for Miyoushe passport API.
-
generate_sign–Generate a sign for the given
dataandapp_key. -
get_authkey–Get an authkey contained in a datafile.
-
get_browser_cookies–Get hoyolab authentication cookies from your browser for later storing.
-
get_ds_headers–Get ds http headers.
-
get_genshin_banner_ids–Get all banner ids from a log file.
-
get_prod_game_biz–Get the game_biz value corresponding to a game and region.
-
prevent_concurrency–Prevent function from running concurrently.
-
recognize_game–Recognize the game of a uid.
-
recognize_genshin_server–Recognize which server a Genshin UID is from.
-
recognize_honkai_server–Recognizes which server a Honkai UID is from.
-
recognize_region–Recognize the region of a uid.
-
recognize_server–Recognizes which server a UID is from.
-
recognize_starrail_server–Recognize which server a Star Rail UID is from.
-
recognize_zzz_server–Recognize which server a Zenless Zone Zero UID is from.
-
update_characters_ambr–Update characters with https://ambr.top/.
-
update_characters_any–Update characters with the most efficient resource.
-
update_characters_enka–Update characters with https://github.com/EnkaNetwork/API-docs/.
-
update_characters_genshindata–Update characters with https://github.com/Dimbreath/GenshinData/.
create_short_lang_code
Create an alternative short lang code.
encrypt_credentials
Encrypt text for geetest.
extract_authkey
Extract an authkey from the provided string.
generate_app_login_ds
Create a dynamic secret for app login.
generate_cn_dynamic_secret
generate_cn_dynamic_secret(body: Any = None, query: Optional[Mapping[str, Any]] = None, *, salt: str = DS_SALT[CHINESE]) -> str
Create a new chinese dynamic secret.
generate_dynamic_secret
Create a new overseas dynamic secret.
generate_geetest_ds
generate_geetest_ds(region: Region) -> str
Create a dynamic secret for geetest API endpoint.
generate_passport_ds
Create a dynamic secret for Miyoushe passport API.
generate_sign
Generate a sign for the given data and app_key.
get_authkey
Get an authkey contained in a datafile.
get_browser_cookies
get_browser_cookies(browser: Optional[str] = None, *, cookie_file: Optional[str] = None, domains: Sequence[str] = DOMAINS, allowed_cookies: Sequence[str] = ALLOWED_COOKIES) -> Mapping[str, str]
Get hoyolab authentication cookies from your browser for later storing.
Available browsers: chrome, chromium, opera, edge, firefox.
get_ds_headers
get_ds_headers(region: Region, data: Any = None, params: Optional[Mapping[str, Any]] = None, lang: Optional[str] = None) -> dict[str, Any]
Get ds http headers.
get_genshin_banner_ids
Get all banner ids from a log file.
get_prod_game_biz
get_prod_game_biz(region: Region, game: Game) -> str
Get the game_biz value corresponding to a game and region.
prevent_concurrency
Prevent function from running concurrently.
This should be done exclusively for functions that cache their result.
recognize_game
Recognize the game of a uid.
recognize_genshin_server
Recognize which server a Genshin UID is from.
recognize_honkai_server
Recognizes which server a Honkai UID is from.
recognize_region
Recognize the region of a uid.
recognize_server
Recognizes which server a UID is from.
recognize_starrail_server
Recognize which server a Star Rail UID is from.
recognize_zzz_server
Recognize which server a Zenless Zone Zero UID is from.
update_characters_ambr
async
Update characters with https://ambr.top/.
update_characters_any
async
update_characters_any(langs: Union[str, Sequence[str], None] = None, *, lenient: bool = False) -> None
Update characters with the most efficient resource.
Will not re-request data if lenient is True.
update_characters_enka
async
Update characters with https://github.com/EnkaNetwork/API-docs/.