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.
Metadata
Release files for zafiaonline 9.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zafiaonline-9.1.11.tar.gz | 61.2 kB | Without provenance | Details for zafiaonline-9.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zafiaonline-9.1.11-py3-none-any.whl | Python 3 | none | any | Details for zafiaonline-9.1.11-py3-none-any.whl |
Total release size: 150.0 kB
Release files / zafiaonline-9.1.11.tar.gz
| Download URL | zafiaonline-9.1.11.tar.gz |
|---|---|
| Size | 61.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcf295c6943f2de5b1d22dc1b9ff4678e0609fc35ad3862a65f60551a8ce553f
|
|
BLAKE2b-256 checksum How to use checksums |
ab3abf004c4b8e201e14475b527917bb8af94e7a80f1a34d598c5dc116f3cd0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / zafiaonline-9.1.11-py3-none-any.whl
| Download URL | zafiaonline-9.1.11-py3-none-any.whl |
|---|---|
| Size | 88.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ba0fd043ee0e34b47d3bfbcb2c9ca97c31f278a28792bd22972704838248bbb
|
|
BLAKE2b-256 checksum How to use checksums |
e1ae1036c7c4c3f285fea21573cdbaf40a5b558a008d1230ca267c3f40869c2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for zafiaonline 9.1.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.