Skip to main content

An API wrapper for Genshin Impact.

Project description

genshin.py

Downloads PyPI package Last Commit Coverage Discord

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genshin-1.5.2.tar.gz (80.2 kB view details)

Uploaded Source

Built Distribution

genshin-1.5.2-py3-none-any.whl (108.7 kB view details)

Uploaded Python 3

File details

Details for the file genshin-1.5.2.tar.gz.

File metadata

  • Download URL: genshin-1.5.2.tar.gz
  • Upload date:
  • Size: 80.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for genshin-1.5.2.tar.gz
Algorithm Hash digest
SHA256 cf87fa53f1e44d030d4bb7c6c7313acb62e6ab528e67d70c4b41378d69277c70
MD5 9164edbe33fa655780621e582cb1a804
BLAKE2b-256 c280128c6e1777a999504f002b1bb6bf89ff8a5aa31cf02c022412c44ba0903b

See more details on using hashes here.

File details

Details for the file genshin-1.5.2-py3-none-any.whl.

File metadata

  • Download URL: genshin-1.5.2-py3-none-any.whl
  • Upload date:
  • Size: 108.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for genshin-1.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9653e1ab160a815c5305685ebf1f97c38f935922f88052c62fcdd054f5c6927a
MD5 b7ab730697331184b895413f7e189a74
BLAKE2b-256 73412bbba98d20b43ebc82e3d22f250bcd734beb29ce018029dab1a59f10f741

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page