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.26.tar.gz (128.9 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.26-py3-none-any.whl (183.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genshin-1.7.26.tar.gz
  • Upload date:
  • Size: 128.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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.26.tar.gz
Algorithm Hash digest
SHA256 1e3daaa4ca24ca85302fad6d9b81a3d3c166ec335345eec49ef804147f000490
MD5 484d9bd447e07eb41e6fab90dccd676c
BLAKE2b-256 35208ac5d88aefeba0bc16162281a348ff772e3b6338951e0ae44c386e94bbcc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genshin-1.7.26-py3-none-any.whl
  • Upload date:
  • Size: 183.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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.26-py3-none-any.whl
Algorithm Hash digest
SHA256 953bda641d3b7e801fb527d99ce9237dab71af60c45c134bdcf8cc139bb5bea4
MD5 d735abd2e2637678c6346e786ac2f782
BLAKE2b-256 2e2e5c021a720e336292655a5cdc3685eb50806e98a9e20c2ed11ffa0c45ba40

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