Skip to main content

API wrapper for HoYoLAB/Miyoushe API built on asyncio and pydantic.

Project description

genshin.py

Downloads PyPI package Last Commit Code Coverage Discord

Modern API wrapper for HoYoLAB & Miyoushe(米游社) API built on asyncio and pydantic.

Project Transferred

genshin.py was originally started by ashleney, due to lack of time to maintain, it has been transferred to seriaati.

Downloading the package from https://github.com/ashleney/genshin.py will still work because GitHub automatically redirects to the new repository.

Useful Links

Introduction

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 English 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.9+
  • aiohttp 3.0+
  • Pydantic 2.0+
  • tenacity 9.0+

Installation

To install the stable version:

pip install genshin

You can also install the latest development version from GitHub:

pip install git+https://github.com/seriaati/genshin.py

A new release is made every month.

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, uid=710785423)

    user = await client.get_genshin_user()
    print(f"User has a total of {user.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.

License

Genshin.py has been actively developed since 2021-02-06. Please report any potential copyright violations to the owner through discord.

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.7.25.tar.gz (128.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genshin-1.7.25-py3-none-any.whl (183.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genshin-1.7.25.tar.gz
  • Upload date:
  • Size: 128.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for genshin-1.7.25.tar.gz
Algorithm Hash digest
SHA256 d7dd40917a4dff5b2b62c2ec91966e2d270c221174fa74731fb33517cb5b4fa7
MD5 a9a877c5ad985587de3a1bfb4a76c6e4
BLAKE2b-256 596ca73f0ac09ac0732c8127beea511ed6ed04f0adb01da9888355cd522c28f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genshin-1.7.25-py3-none-any.whl
  • Upload date:
  • Size: 183.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for genshin-1.7.25-py3-none-any.whl
Algorithm Hash digest
SHA256 de82ae1ffc2cf6af5427888dffbf99f82f4799e539afb56c92913e2f4f1fb766
MD5 02ad300ea3353270dfba7cfea01292c0
BLAKE2b-256 f62d73a0f94b0881cfd3c7e787e5c8fea54e45342ac1deb850cf5fcff87d22e3

See more details on using hashes here.

Supported by

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