Skip to content

Interacting With the API

seria edited this page May 13, 2024 · 12 revisions

Genshin Impact

To interact with the Enka Network Genshin Impact API, use the GenshinClient.

import enka

async with enka.GenshinClient() as client:
    await client.fetch_showcase(901211014)

Alternatively, call the start and close methods manually.

import enka

client = enka.GenshinClient()
await client.start()
await client.fetch_showcase(901211014)
await client.stop()

Important

When using the client, you must use either the async with syntax or call start and stop manually; otherwise, the client won't work and RuntimeError will be raised.

Honkai: Star Rail

Similarly, to interact with the Enka Network HSR API, use the HSRClient.

import enka

async with enka.HSRClient() as client:
    await client.fetch_showcase(809162009)

Same as GenshinClient, you can also call the start and close methods manually.

import enka

client = enka.HSRClient()
await client.start()
await client.fetch_showcase(809162009)
await client.stop()
Clone this wiki locally