-
Notifications
You must be signed in to change notification settings - Fork 3
Client Parameters
seria edited this page May 13, 2024
·
3 revisions
Both GenshinClient
and HSRClient
are subclasses of the BaseClient
, it has the following parameters:
Changes the language of contents returned by the wrapper, such as weapon names, character names, etc.
import enka
# With enum
async with enka.GenshinClient(enka.gi.Language.RUSSIAN) as client:
...
async with enka.HSRClient(enka.hsr.Language.THAI) as client:
...
# Or with str
async with enka.GenshinClient("ru") as client:
...
async with enka.HSRClient("th") as client:
...
Changes the headers when requesting to the Enka Network API, default is {"User-Agent": "enka-py"}
import enka
async with enka.GenshinClient(headers={"User-Agent": "MyDiscordBot-1.0"}) as client:
...
# Same goes for HSRClient
The time to live (ttl) in seconds for the internal cache to be evicted, the default is 60 seconds, which is the minimum refresh time in Enka Network. Increasing this value might result in inconsistency between the data returned by the wrapper and the live data.
import enka
async with enka.GenshinClient(cache_ttl=30) as client:
...
# Same goes for HSRClient