An API wrapper for Genshin Impact.
Project description
genshin.py
Modern API wrapper for Genshin Impact & Honkai Impact 3rd built on asyncio and pydantic.
Documentation: https://thesadru.github.io/genshin.py
API Reference: https://thesadru.github.io/genshin.py/pdoc/genshin
Source Code: https://github.com/thesadru/genshin.py
The primary focus of genshin.py is convenience. The entire project is fully type-hinted and abstracts a large amount of the api to be easier to use.
Key features:
- All data is in the form of Pydantic Models which means full autocompletion and linter support.
- Requests are significantly faster thanks to proper usage of asyncio.
- Chinese and Engrish names returned by the API are renamed to simpler English fields.
- Supports the majority of the popular endpoints.
- Cleanly integrates with frameworks like FastAPI out of the box.
Note: This library is a successor to genshinstats - an unofficial wrapper for the Genshin Impact api.
Requirements
- Python 3.8+
- aiohttp
- Pydantic
pip install genshin
Example
A very simple example of how genshin.py would be used:
import asyncio
import genshin
async def main():
cookies = {"ltuid": 119480035, "ltoken": "cnF7TiZqHAAvYqgCBoSPx5EjwezOh1ZHoqSHf7dT"}
client = genshin.Client(cookies)
data = await client.get_genshin_user(710785423)
print(f"User has a total of {data.stats.characters} characters")
asyncio.run(main())
Contributing
Any kind of contribution is welcome. Please read CONTRIBUTING.md to see what you need to do to make a contribution.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file genshin-1.7.1.tar.gz
.
File metadata
- Download URL: genshin-1.7.1.tar.gz
- Upload date:
- Size: 101.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d591f263ea914a5cd1f2a6d9cfe0d457cedb274bdfb2b8b689afff4b6df1d4e3 |
|
MD5 | d7c3e888877e3c78f8b67298187bff6b |
|
BLAKE2b-256 | 56ca8285d6fe09a8565c7f244534196ae2dbcab60add29db9cca3a69341b35dc |
File details
Details for the file genshin-1.7.1-py3-none-any.whl
.
File metadata
- Download URL: genshin-1.7.1-py3-none-any.whl
- Upload date:
- Size: 138.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d9b91581f4beadea362ad59fc09d25db3af2f6ffe6e0650350555921327f560 |
|
MD5 | f9f1f0a53a1a0a6dc2424c434ee18314 |
|
BLAKE2b-256 | ee9e26ade5f00abfac898021f6d71016407b75a91d8c149284239040566eb842 |