zafiaonline package

Subpackages

Submodules

zafiaonline.main module

Unified client for Mafia Online services.

This module provides a unified interface for interacting with the MafiaOnline API. It includes methods for authentication, room management, global chat, matchmaking, and more.

Typical usage example:

client = Client() client.auth.login(…)

class zafiaonline.main.Client(proxy=None)[source]

Bases: object

Unified API client for MafiaOnline.

Provides a single entry point for interacting with different MafiaOnline services. Each service (submodule) is lazily imported on first access and cached for reuse. This design allows modular usage without eagerly loading all dependencies.

Submodules are automatically initialized with the shared client context and, when required, with the authentication submodule.

Parameters:

proxy (str | None)

proxy

Optional proxy URL used for HTTPS requests.

Type:

str | None

_cache

Stores lazily created submodule instances.

Type:

dict[str, Any]

property auth: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property user: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property players: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property global_chat: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property room: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property matchmaking: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property https: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property zafia: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

zafiaonline.version module

Module contents

class zafiaonline.Client(proxy=None)[source]

Bases: object

Unified API client for MafiaOnline.

Provides a single entry point for interacting with different MafiaOnline services. Each service (submodule) is lazily imported on first access and cached for reuse. This design allows modular usage without eagerly loading all dependencies.

Submodules are automatically initialized with the shared client context and, when required, with the authentication submodule.

Parameters:

proxy (str | None)

proxy

Optional proxy URL used for HTTPS requests.

Type:

str | None

_cache

Stores lazily created submodule instances.

Type:

dict[str, Any]

property auth: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property global_chat: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property https: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property matchmaking: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property players: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property room: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property user: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.

property zafia: object

Retrieve or initialize the submodule instance.

This getter is used internally by make_submodule_property to lazily construct and cache submodules on first access. It builds the keyword arguments from the provided init factories, then delegates submodule loading to Client._import_submodule().

Returns:

The cached or newly created submodule instance.

Return type:

object

Raises:
  • RuntimeError – If building kwargs from init factories fails, or if the submodule class fails to initialize.

  • ImportError – If the target module or class cannot be imported.