Metadata-Version: 2.4
Name: ms_api
Version: 0.11.252
Summary: Python wrapper for the Mahjong Soul (Majsoul) Protobuf objects. It allows to use their API.
Author-email: Nihisil <alexey@nihisil.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/MahjongRepository/mahjong_soul_api
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: protobuf>=5.29
Requires-Dist: websockets>=15.0.1

The idea of repository based on https://github.com/chaserhkj/PyMajSoul/

Python wrappers for Majsoul allow you to interact with their servers from Python scripts.

## For User

1. Install [uv](https://docs.astral.sh/uv/)
2. `uv run example.py -u username -p password`

The example logs in and lists your latest 30 games. Pass `-l <game uuid>` to load one game log instead.

This example is working only with **Python3.9+**.

Also, you need to have an account from CN server to run this example, because only accounts from CN server has the ability to login with login and password.

If you want to login to EN or JP servers you need to write your code to authenticate via email code or social network. Protobuf wrapper from this repository contains all needed API objects for that.

## For Developer

### Requirements

1. `uv sync`
1. Install protobuf compiler `sudo apt install protobuf-compiler`

### How to update protocol files to the new version

It was tested on Ubuntu.

1. Download the new `liqi.json` file from MS (find it in the network tab of your browser) and put it to `ms/liqi.json`
1. `python generate_proto_file.py`
1. `protoc --python_out=. protocol.proto`
1. `chmod +x ms-plugin.py`
1. `sudo cp ms-plugin.py /usr/bin/ms-plugin.py`
1. `protoc --custom_out=. --plugin=protoc-gen-custom=ms-plugin.py ./protocol.proto`

### How to release new version

1. Bump `version` in `pyproject.toml`
2. `uv build`
3. `uv publish`
