mahjong_soul_api
mahjong_soul_api copied to clipboard
Python wrapper for the Mahjong Soul (Majsoul) Protobuf objects. It allows to use their API.
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
- Install python packages from
requirements.txt
-
python example.py -u username -p password
This example is working only with Python3.7+.
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
- Install python packages from
requerements.txt
- Install protobuf compiler
sudo apt install protobuf-compiler
How to update protocol files to the new version
It was tested on Ubuntu.
- Download the new
liqi.json
file from MS (find it in the network tab of your browser) and put it toms/liqi.json
-
python generate_proto_file.py
-
protoc --python_out=. protocol.proto
-
chmod +x ms-plugin.py
-
sudo cp ms-plugin.py /usr/bin/ms-plugin.py
-
protoc --custom_out=. --plugin=protoc-gen-custom=ms-plugin.py ./protocol.proto
How to update protocol files for manager API to the new version
- Prepare new
liqi_admin.json
file from MS tournament manager panel -
python ms_tournament/generate_proto_file.py
-
protoc --python_out=. protocol_admin.proto
-
chmod +x ms-admin-plugin.py
-
sudo cp ms-admin-plugin.py /usr/bin/ms-admin-plugin.py
-
protoc --custom_out=. --plugin=protoc-gen-custom=ms-admin-plugin.py ./protocol_admin.proto
How to release new version
-
pip install twine
-
python setup.py sdist
-
twine upload dist/*