maimai-py


Namemaimai-py JSON
Version 0.7.3 PyPI version JSON
download
home_pageNone
SummaryThe definitive python wrapper for MaimaiCN.
upload_time2025-01-22 03:55:50
maintainerNone
docs_urlNone
authorUsagi no Niku
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # maimai.py ([documentation](https://maimai.turou.fun))

[![PyPI version](https://img.shields.io/pypi/v/maimai-py)](https://pypi.org/project/maimai-py/)
![License](https://img.shields.io/pypi/l/maimai-py)
![Python versions](https://img.shields.io/pypi/pyversions/maimai-py)
[![zh](https://img.shields.io/badge/README-中文-green.svg)](https://github.com/TrueRou/maimai.py/blob/main/README_CN.md)

<p align="center">
  <a href="https://maimai.turou.fun">
      <img src="https://s2.loli.net/2024/12/23/7T5nbMfzdAi8BtF.png" alt="maimai.py" />
  </a>
</p>

The definitive python wrapper for MaimaiCN related development, wrapping the frequently used methods from DivingFish and LXNS.

We provide data models and methods based on MaiMai standard, and make implementation for both DivingFish and LXNS.

Support querying songs, player information, scores, ratings, name plates from any data sources.

In addition, we support getting player scores with WeChat OpenID, parsing the score HTML, and uploading it to the data sources.

## Installation

```bash
pip install maimai-py
```

To upgrade:

```bash
pip install -U maimai-py
```

For more, read the docs: https://maimai.turou.fun/.

Additionally, you can [download the maimai.py client](https://github.com/TrueRou/maimai.py/releases) and develop using any programming language.

## Quickstart

```python
import asyncio
from maimai_py import MaimaiClient, MaimaiPlates, MaimaiScores, MaimaiSongs, PlayerIdentifier, LXNSProvider, DivingFishProvider


async def quick_start():
    maimai = MaimaiClient()
    divingfish = DivingFishProvider(developer_token="")

    # fetch all songs and their metadata
    songs: MaimaiSongs = await maimai.songs()
    # fetch divingfish user turou's scores (b50 scores by default)
    scores: MaimaiScores = await maimai.scores(PlayerIdentifier(username="turou"), provider=divingfish)
    # fetch divingfish user turou's 舞将 plate information
    plates: MaimaiPlates = await maimai.plates(PlayerIdentifier(username="turou"), "舞将", provider=divingfish)

    song = songs.by_id(1231)  # 生命不詳 by 蜂屋ななし

    print(f"Song 1231: {song.artist} - {song.title}")
    print(f"TuRou's rating: {scores.rating}, b15 top rating: {scores.scores_b15[0].dx_rating}")
    print(f"TuRou's 舞将: {plates.cleared_num}/{plates.all_num} cleared")

asyncio.run(quick_start())
```

## Async

maimai.py is fully asynchronous by default, and there are no plans to provide synchronous methods.

If you don't want to be asynchronous, you can use the `asyncio.run` wrapper to call asynchronous methods synchronously.

## Client

maimai.py provides a RESTful API client, which you can call maimai.py features via HTTP requests from any language.

The client is compiled using Nuitka, please download it from the [Releases](https://github.com/TrueRou/maimai.py/releases) page.

Our client supports Windows and Linux, please download the corresponding version according to your system.

For the client API documentation, please see: https://openapi.maimai.turou.fun/.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "maimai-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Usagi no Niku",
    "author_email": "chenbohan911@163.com",
    "download_url": "https://files.pythonhosted.org/packages/e8/0b/044a3d50b9f6df5d56eb8e6abc8c833c2df7395ce0d560ed16f6407f067e/maimai_py-0.7.3.tar.gz",
    "platform": null,
    "description": "# maimai.py ([documentation](https://maimai.turou.fun))\n\n[![PyPI version](https://img.shields.io/pypi/v/maimai-py)](https://pypi.org/project/maimai-py/)\n![License](https://img.shields.io/pypi/l/maimai-py)\n![Python versions](https://img.shields.io/pypi/pyversions/maimai-py)\n[![zh](https://img.shields.io/badge/README-\u4e2d\u6587-green.svg)](https://github.com/TrueRou/maimai.py/blob/main/README_CN.md)\n\n<p align=\"center\">\n  <a href=\"https://maimai.turou.fun\">\n      <img src=\"https://s2.loli.net/2024/12/23/7T5nbMfzdAi8BtF.png\" alt=\"maimai.py\" />\n  </a>\n</p>\n\nThe definitive python wrapper for MaimaiCN related development, wrapping the frequently used methods from DivingFish and LXNS.\n\nWe provide data models and methods based on MaiMai standard, and make implementation for both DivingFish and LXNS.\n\nSupport querying songs, player information, scores, ratings, name plates from any data sources.\n\nIn addition, we support getting player scores with WeChat OpenID, parsing the score HTML, and uploading it to the data sources.\n\n## Installation\n\n```bash\npip install maimai-py\n```\n\nTo upgrade:\n\n```bash\npip install -U maimai-py\n```\n\nFor more, read the docs: https://maimai.turou.fun/.\n\nAdditionally, you can [download the maimai.py client](https://github.com/TrueRou/maimai.py/releases) and develop using any programming language.\n\n## Quickstart\n\n```python\nimport asyncio\nfrom maimai_py import MaimaiClient, MaimaiPlates, MaimaiScores, MaimaiSongs, PlayerIdentifier, LXNSProvider, DivingFishProvider\n\n\nasync def quick_start():\n    maimai = MaimaiClient()\n    divingfish = DivingFishProvider(developer_token=\"\")\n\n    # fetch all songs and their metadata\n    songs: MaimaiSongs = await maimai.songs()\n    # fetch divingfish user turou's scores (b50 scores by default)\n    scores: MaimaiScores = await maimai.scores(PlayerIdentifier(username=\"turou\"), provider=divingfish)\n    # fetch divingfish user turou's \u821e\u5c06 plate information\n    plates: MaimaiPlates = await maimai.plates(PlayerIdentifier(username=\"turou\"), \"\u821e\u5c06\", provider=divingfish)\n\n    song = songs.by_id(1231)  # \u751f\u547d\u4e0d\u8a73 by \u8702\u5c4b\u306a\u306a\u3057\n\n    print(f\"Song 1231: {song.artist} - {song.title}\")\n    print(f\"TuRou's rating: {scores.rating}, b15 top rating: {scores.scores_b15[0].dx_rating}\")\n    print(f\"TuRou's \u821e\u5c06: {plates.cleared_num}/{plates.all_num} cleared\")\n\nasyncio.run(quick_start())\n```\n\n## Async\n\nmaimai.py is fully asynchronous by default, and there are no plans to provide synchronous methods.\n\nIf you don't want to be asynchronous, you can use the `asyncio.run` wrapper to call asynchronous methods synchronously.\n\n## Client\n\nmaimai.py provides a RESTful API client, which you can call maimai.py features via HTTP requests from any language.\n\nThe client is compiled using Nuitka, please download it from the [Releases](https://github.com/TrueRou/maimai.py/releases) page.\n\nOur client supports Windows and Linux, please download the corresponding version according to your system.\n\nFor the client API documentation, please see: https://openapi.maimai.turou.fun/.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The definitive python wrapper for MaimaiCN.",
    "version": "0.7.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8fa6c0755197b1b9febbccbc5baa76e12d3d099306e87409b07d4fa757b84b73",
                "md5": "95800a4636c6d39f9afbbfbd03843e88",
                "sha256": "dc33ca9ae42f985eff1a6a301254aac9c054c7a216af0d7580b12efdba17dc28"
            },
            "downloads": -1,
            "filename": "maimai_py-0.7.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "95800a4636c6d39f9afbbfbd03843e88",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 93886,
            "upload_time": "2025-01-22T03:55:48",
            "upload_time_iso_8601": "2025-01-22T03:55:48.779912Z",
            "url": "https://files.pythonhosted.org/packages/8f/a6/c0755197b1b9febbccbc5baa76e12d3d099306e87409b07d4fa757b84b73/maimai_py-0.7.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e80b044a3d50b9f6df5d56eb8e6abc8c833c2df7395ce0d560ed16f6407f067e",
                "md5": "7107402cefa11a4a542b2f17eeaeba39",
                "sha256": "a0d0851a6e9b8f14e68f32cf399cc0c865caf83ef285b3d30c78226d11326152"
            },
            "downloads": -1,
            "filename": "maimai_py-0.7.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7107402cefa11a4a542b2f17eeaeba39",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 84325,
            "upload_time": "2025-01-22T03:55:50",
            "upload_time_iso_8601": "2025-01-22T03:55:50.489441Z",
            "url": "https://files.pythonhosted.org/packages/e8/0b/044a3d50b9f6df5d56eb8e6abc8c833c2df7395ce0d560ed16f6407f067e/maimai_py-0.7.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-22 03:55:50",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "maimai-py"
}
        
Elapsed time: 0.45919s