A Python API library for interacting with Mafia Online game.
Project description
Mafia Online API for Python
A Python client library for Mafia Online.
Temporary Suspension of Library Updates
During an audit, it was discovered that my code was being used in violation of the terms of the GPL license. As a result, an investigation is currently underway.
Until the situation is resolved, no updates to the library to support the new API will be released.
Further updates and a possible timeline for resuming development will be provided after the investigation is complete.
Overview
zafiaonline is a small library providing utilities and client functionality for interacting with the Mafia Online service. It includes:
- an async
Clientfor authentication and API calls, - anti-ban utilities and message tracking helpers,
- transport layers and ancillary utilities.
Full documentation is available at ReadtheDocs
Install
Install from PyPI:
pip install zafiaonline
Install for development from source:
python -m venv .venv
source .venv/bin/activate # macOS / Linux
pip install -e .
pip install -r docs/requirements.txt # optional: build docs locally
Quickstart — Import and Auth
Example using the async Client:
import asyncio
import zafiaonline
async def main():
client = zafiaonline.Client()
await client.auth.sign_in("email@example.com", "your_password")
# Use the client for API calls, then sign out
await client.https.sign_out()
asyncio.run(main())
If you prefer a synchronous helper wrapper, wrap async calls via asyncio.run() or your own event loop.
Examples
Create a client and fetch some data (pseudo-code):
import asyncio
import zafiaonline
async def example():
client = zafiaonline.Client()
await client.auth.sign_in("email", "password")
profile = await client.players.get_user("user_xxxxxxxxxxxx") # example id
print(profile[zafiaonline.PacketDataKeys.USER_PROFILE][zafiaonline.PacketDataKeys.PROFILE_USER_DATA])
await client.https.sign_out()
asyncio.run(example())
Adjust imports and method names to the actual API surface of your package.
Documentation
Docs are published at: https://zafiaonlinepy.readthedocs.io/en/latest/
Build docs locally:
cd docs
make html
# Open docs/_build/html/index.html
If you use the src/ layout, ensure docs/source/conf.py contains:
import os
import sys
sys.path.insert(0, os.path.abspath("../../src"))
master_doc = "index"
Read the Docs (CI) config
Example .readthedocs.yaml to place in the repo root:
version: 2
build:
os: ubuntu-22.04
tools:
python: latest
sphinx:
configuration: docs/source/conf.py
python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
And docs/requirements.txt (basic):
sphinx
sphinx-rtd-theme
Configuration (YAML)
The library also supports configuration via a YAML file for WebSocket connection parameters.
Example config.yaml:
host: "dottap.com"
port: 7091
connect_type: "wss"
You can then load and use it inside your project:
class Config:
def __init__(self, path: str = "ws_config.yaml") -> None:
config_path = files('zafiaonline.transport.websocket').joinpath(path)
with as_file(config_path) as resource_file:
with open(resource_file, "r") as config_file:
config: dict = yaml.safe_load(config_file)
self.address: str = config.get("address", "dottap.com")
self.port: int = config.get("port", 7091)
self.connect_type: str = config.get("connect_type", "wss")
This way, connection details are kept separate from your code and can be changed without modifying Python files.
Troubleshooting Sphinx / Documentation
-
Unexpected indentation— fix docstring code examples: use:then an indented literal block:"""Typical Usage Example: messages = SentMessages(enable_logging=True) messages.add_message("hello") """
-
Index file is not present— ensuredocs/source/index.rstexists andmaster_doc = "index"inconf.py. -
Duplicate or ambiguous cross-references — avoid re-exporting the same object in
__init__.pyor use fully-qualified cross-references (e.g.:class:\zafiaonline.main.Client``) or:no-index:to suppress duplicates.
Contributing
- Fork the repo → create a feature branch → open a PR.
- Follow code style and include tests for non-trivial changes.
- In PR description, explain changes and link documentation where applicable.
License
This project is licensed under GNU GPL v3.0 or later. See the LICENSE file for details.
Contact
Author: unelected
Bugs & feature requests: open an issue on the repository.
Project details
Release history Release notifications | RSS feed
6.0.0 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.5.0 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.4.0 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.3.0 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.2.5 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.2.4 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.2.3 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.2.2 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.2.1 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.2.0 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.1.1 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.1.0 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
5.0.1 yanked
Reason this release was yanked:
This version is no longer supported due to API changes.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zafiaonline-9.1.11.tar.gz.
File metadata
- Download URL: zafiaonline-9.1.11.tar.gz
- Upload date:
- Size: 61.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf295c6943f2de5b1d22dc1b9ff4678e0609fc35ad3862a65f60551a8ce553f
|
|
| MD5 |
d77edf7aea76455bd4e22180d4956310
|
|
| BLAKE2b-256 |
ab3abf004c4b8e201e14475b527917bb8af94e7a80f1a34d598c5dc116f3cd0a
|
File details
Details for the file zafiaonline-9.1.11-py3-none-any.whl.
File metadata
- Download URL: zafiaonline-9.1.11-py3-none-any.whl
- Upload date:
- Size: 88.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ba0fd043ee0e34b47d3bfbcb2c9ca97c31f278a28792bd22972704838248bbb
|
|
| MD5 |
b8a5a9c095c4483a3486974121af2731
|
|
| BLAKE2b-256 |
e1ae1036c7c4c3f285fea21573cdbaf40a5b558a008d1230ca267c3f40869c2a
|