maimai-py


Namemaimai-py JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryThe definitive python wrapper for MaimaiCN.
upload_time2024-12-23 02:44:01
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)


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/.

## 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.
            

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/dd/0d/c838167a2dabb01a17106686c1dcf020dfd2a83cf5357391f32527e26589/maimai_py-0.3.0.tar.gz",
    "platform": null,
    "description": "# maimai.py ([documentation](https://maimai.turou.fun/))\n\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\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\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.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The definitive python wrapper for MaimaiCN.",
    "version": "0.3.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84ea3a4bff5cffc165a8441baee34dac2a4c76c6dabee88f00c9929e6984f1c4",
                "md5": "70b3dc8bcb51828ee25e48e90e2f593b",
                "sha256": "6e5172ef241c354f49023001f4825dc4b064a64113ef844a0f990dbce0a59f1d"
            },
            "downloads": -1,
            "filename": "maimai_py-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "70b3dc8bcb51828ee25e48e90e2f593b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 24786,
            "upload_time": "2024-12-23T02:43:59",
            "upload_time_iso_8601": "2024-12-23T02:43:59.848675Z",
            "url": "https://files.pythonhosted.org/packages/84/ea/3a4bff5cffc165a8441baee34dac2a4c76c6dabee88f00c9929e6984f1c4/maimai_py-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd0dc838167a2dabb01a17106686c1dcf020dfd2a83cf5357391f32527e26589",
                "md5": "9acdfb0cebc02f9d26183d83b3eb9a99",
                "sha256": "cc5c7c90019d597c3cf0fec2a6bf0e74c3a817b2466c637a7bffa51a40d9943c"
            },
            "downloads": -1,
            "filename": "maimai_py-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9acdfb0cebc02f9d26183d83b3eb9a99",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 19100,
            "upload_time": "2024-12-23T02:44:01",
            "upload_time_iso_8601": "2024-12-23T02:44:01.143829Z",
            "url": "https://files.pythonhosted.org/packages/dd/0d/c838167a2dabb01a17106686c1dcf020dfd2a83cf5357391f32527e26589/maimai_py-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-23 02:44:01",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "maimai-py"
}
        
Elapsed time: 0.40661s