-
Notifications
You must be signed in to change notification settings - Fork 0
Client Parameters
seria edited this page Jul 24, 2024
·
2 revisions
HakushinAPI
is the main class that you use to interact with the hakush.in API.
The HakushinAPI
class has the following parameters:
Changes the game of the API you are requesting to with this client.
import hakushin
async with hakushin.HakushinAPI(hakushin.Game.HSR) as api:
await api.fetch_light_cones()
Changes the language of contents returned by the wrapper, such as weapon names, light cone names, etc.
Defaults to English.
import hakushin
async with hakushin.HakushinAPI(hakushin.Language.ZH) as api:
...
Changes the headers when requesting to the Enka Network API, defaults to {"User-Agent": "hakushin-py"}
import hakushin
async with hakushin.HakushinAPI(headers={"User-Agent": "MyDiscordBot-1.0"}) as api:
...
The path to the cache SQLite db file, defaults to ./.cache/hakushin/aiohttp-cache.db
.
import hakushin
async with hakushin.HakushinAPI(cache_path="cool_cahe.db") as api:
...
The time to live (ttl) in seconds for the cache to be evicted, defaults to 3600 seconds.
import hakushin
async with hakushin.HakushinAPI(cache_ttl=30) as api:
...