Skip to main content

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.

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.

Metadata

Release files for genshin 1.7.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genshin 1.7.32
File Size Uploaded Provenance Actions
genshin-1.7.32.tar.gz 151.7 kB Without provenance Details for genshin-1.7.32.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for genshin 1.7.32
File Interpreter ABI Platform Actions
genshin-1.7.32-py3-none-any.whl Python 3 none any Details for genshin-1.7.32-py3-none-any.whl

Total release size: 355.6 kB

Release files / genshin-1.7.32.tar.gz

Download URL genshin-1.7.32.tar.gz
Size 151.7 kB
Tags Source
SHA-256 checksum
How to use checksums
85726d7899debb420c9b8ed167484919a4aa8e1e92dcb0ae3ac87ad8585a1035
BLAKE2b-256 checksum
How to use checksums
2ab2b5bb735c0cfc08c30765edf682e0bd55e6ef46db16434966835eea653d3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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}

Release files / genshin-1.7.32-py3-none-any.whl

Download URL genshin-1.7.32-py3-none-any.whl
Size 203.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46ecd15e5e53f46d644ff1c047b106161a586f630f6ea4309c40b747024a0668
BLAKE2b-256 checksum
How to use checksums
1c3e40b109f4e268a16d738458fd218490774a96b140858e5b6b85779057ab49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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}

Security for genshin 1.7.32

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.7.32 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page