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.28.tar.gz (134.7 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.28-py3-none-any.whl (190.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genshin-1.7.28.tar.gz
  • Upload date:
  • Size: 134.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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.28.tar.gz
Algorithm Hash digest
SHA256 6e5a6271093572e65ae0f28a70276f01f0505c9ec8eab9a15e04b5abd2b5941d
MD5 60799d6c3df9cc582fe03ad182588075
BLAKE2b-256 6baeff9b7f6e9b1e8d78e1d0d19fa0c570dc14dcc6cd43ffadd5c09b21c13720

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genshin-1.7.28-py3-none-any.whl
  • Upload date:
  • Size: 190.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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.28-py3-none-any.whl
Algorithm Hash digest
SHA256 573c92580533e872630390c8c27638899348405042309bab928ec9c0afd7efe3
MD5 d34b969b98941ba77d71a3e979f75c79
BLAKE2b-256 3661f905a5b9fa43d542a9bcf1e5c2ad9ecf47321cbc6576d13c44a6b37daf09

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