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.23.tar.gz (127.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.23-py3-none-any.whl (184.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genshin-1.7.23.tar.gz
  • Upload date:
  • Size: 127.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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.23.tar.gz
Algorithm Hash digest
SHA256 cc894bfcfbf59a40e783229ad4b0448b9ded9fd51da9019caaa0159835bc1f79
MD5 0793da0978784afbe567d5c9f93ee1ab
BLAKE2b-256 9209dd3d2abe3fe7b08d3f8f46045312474243f6cb985b77e868c9439911f062

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genshin-1.7.23-py3-none-any.whl
  • Upload date:
  • Size: 184.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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.23-py3-none-any.whl
Algorithm Hash digest
SHA256 94b1bfa8f032aa16e4a537e5837f22c5a14fff44b222393ccf3ccb0dd78e541b
MD5 cc0893afbdb599c8a785f8bb2b3b82b5
BLAKE2b-256 1710f18721e02bbc38cf52296d4ded9c7ecc695a2ed5349e5d9f6606e0eb492c

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