zafiaonline.api_client.https_api package

Submodules

zafiaonline.api_client.https_api.https_api module

HTTPS API client for Mafia Online.

Provides an interface for communicating with the Mafia Online backend via HTTPS requests. This module includes account management, configuration retrieval, backpack interactions, and other client-related endpoints.

Typical usage example:

api = HttpsApiMethods(proxy=”http://localhost:8080”) response = await api.sign_up(email=”user@example.com”, password=”secure123”) config = await api.get_client_config()

class zafiaonline.api_client.https_api.https_api.HttpsApiMethods[source]

Bases: object

Provides HTTPS API interaction.

This class extends HttpWrapper to provide additional functionality for secure API access over HTTPS, including hashing utilities.

md5hash

An instance of Md5 used for computing MD5 hashes.

await remove_user_account_request(language=MafiaLanguages.English)[source]

Sends a request to remove the user’s account.

This method sends a POST request to the server to initiate account removal, using the specified language for localization.

Parameters:

language (MafiaLanguages) – A MafiaLanguages enum value indicating the language to use in the request. Defaults to English.

Returns:

The server’s response to the account removal request, typically a dictionary or raw bytes depending on API implementation.

Return type:

dict | bytes

await get_profile_photo_request(user_id)[source]

Retrieves the profile photo of a user by user ID.

Sends a GET request to the server to fetch the profile picture associated with the specified user.

Parameters:

user_id (str) – The unique identifier of the user whose profile photo should be retrieved.

Returns:

The server response containing the profile photo data. This can be a dictionary with metadata or raw image bytes.

Return type:

dict | bytes

await get_client_config(version=55)[source]

Fetches the client configuration for a given version.

Sends a GET request to retrieve configuration settings used by the client, such as feature flags, limits, or layout settings.

Parameters:

version (int) – The version number of the client configuration to retrieve. Defaults to 55.

Returns:

The client configuration data returned by the server. Can be a parsed JSON dictionary or raw response bytes.

Return type:

dict | bytes

await get_client_feature_config()[source]

Fetches the client feature configuration.

Sends a GET request to retrieve a list of enabled or experimental features available to the client.

Returns:

The feature configuration returned by the server. May be a parsed JSON dictionary or raw response bytes.

Return type:

dict | bytes

await sign_out()[source]

Signs the user out of the current session.

Sends a POST request to terminate the user’s active session on the server.

Returns:

The server’s response to the sign-out request, which may be a parsed JSON dictionary or raw response bytes.

Return type:

dict | bytes

await sign_up(email, password, username='', language=MafiaLanguages.English)[source]

Registers a new user account.

Sends a sign-up request to the server with email, password, and optional username.

Parameters:
  • email (str) – The user’s email address.

  • password (str) – The user’s password, which will be hashed before sending.

  • username (str, optional) – An optional display name for the user.

  • language (MafiaLanguages) – The preferred language for the account.

Returns:

The server’s response to the sign-up request, either as parsed JSON or raw bytes.

Return type:

dict | bytes

await verify_email(language=MafiaLanguages.English)[source]

Sends a verification email to the user’s address.

Parameters:

language (MafiaLanguages) – The preferred language for the email content.

Returns:

The server’s response containing status or raw response bytes.

Return type:

dict[str, str] | bytes

await change_email(new_email, password, language=MafiaLanguages.English)[source]

Sends a request to change the user’s email address.

Parameters:
  • new_email (str) – The new email address to set for the user.

  • password (str) – The user’s current password (used for verification).

  • language (MafiaLanguages) – The preferred language for the response.

Returns:

A dictionary with the server response on success, or raw bytes if the response is not JSON.

Return type:

dict | bytes

await email_verification(verification_code)[source]

Submits the email verification code to complete verification.

Parameters:

verification_code (str) – The code sent to the user’s email for verification.

Returns:

A dictionary containing the server response, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

await user_get(user_id)[source]

Retrieves public information about a user by their ID.

Parameters:

user_id (str) – The unique identifier of the user.

Returns:

A dictionary with the user’s public profile data, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

await backpack_get()[source]

Fetches the contents of the user’s backpack.

Returns:

A dictionary containing the backpack items, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

await backpack_get_bonus_prices()[source]

Retrieves bonus price information for backpack items.

Returns:

A dictionary with bonus pricing details, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

zafiaonline.api_client.https_api.https_api_helpers module

class zafiaonline.api_client.https_api.https_api_helpers.HttpsHelpers[source]

Bases: object

await get_mafia_request(endpoint, params=None)[source]

Perform a GET request to the MafiaOnline API.

Parameters:
  • endpoint (str) – API endpoint path or full URL.

  • params (dict[str, Any] | None) – Optional query parameters.

Returns:

JSON-decoded response if available, otherwise raw bytes or dict with an “error” key.

Return type:

dict[str, Any] | bytes

await post_api_mafia_request(endpoint, data=None)[source]

Perform a POST request to the MafiaOnline API.

Parameters:
  • endpoint (str) – API endpoint path or full URL.

  • data (dict[str, Any] | None) – Data to include in the POST body.

  • headers (dict[str, str] | None) – Optional request headers.

Returns:

JSON-decoded response if available, otherwise raw bytes or dict with an “error” key.

Return type:

dict[str, Any] | bytes

await get_api_mafia_request(endpoint, data=None)[source]

Perform a GET request to the MafiaOnline API.

Parameters:
  • endpoint (str) – API endpoint path or full URL.

  • data (dict[str, Any] | None) – Data to include in the POST body.

  • headers (dict[str, str] | None) – Optional request headers.

Returns:

JSON-decoded response if available, otherwise raw bytes or dict with an “error” key.

Return type:

dict[str, Any] | bytes

Module contents

class zafiaonline.api_client.https_api.HttpsApiMethods[source]

Bases: object

Provides HTTPS API interaction.

This class extends HttpWrapper to provide additional functionality for secure API access over HTTPS, including hashing utilities.

md5hash

An instance of Md5 used for computing MD5 hashes.

await backpack_get()[source]

Fetches the contents of the user’s backpack.

Returns:

A dictionary containing the backpack items, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

await backpack_get_bonus_prices()[source]

Retrieves bonus price information for backpack items.

Returns:

A dictionary with bonus pricing details, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

await change_email(new_email, password, language=MafiaLanguages.English)[source]

Sends a request to change the user’s email address.

Parameters:
  • new_email (str) – The new email address to set for the user.

  • password (str) – The user’s current password (used for verification).

  • language (MafiaLanguages) – The preferred language for the response.

Returns:

A dictionary with the server response on success, or raw bytes if the response is not JSON.

Return type:

dict | bytes

await email_verification(verification_code)[source]

Submits the email verification code to complete verification.

Parameters:

verification_code (str) – The code sent to the user’s email for verification.

Returns:

A dictionary containing the server response, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

await get_client_config(version=55)[source]

Fetches the client configuration for a given version.

Sends a GET request to retrieve configuration settings used by the client, such as feature flags, limits, or layout settings.

Parameters:

version (int) – The version number of the client configuration to retrieve. Defaults to 55.

Returns:

The client configuration data returned by the server. Can be a parsed JSON dictionary or raw response bytes.

Return type:

dict | bytes

await get_client_feature_config()[source]

Fetches the client feature configuration.

Sends a GET request to retrieve a list of enabled or experimental features available to the client.

Returns:

The feature configuration returned by the server. May be a parsed JSON dictionary or raw response bytes.

Return type:

dict | bytes

await get_profile_photo_request(user_id)[source]

Retrieves the profile photo of a user by user ID.

Sends a GET request to the server to fetch the profile picture associated with the specified user.

Parameters:

user_id (str) – The unique identifier of the user whose profile photo should be retrieved.

Returns:

The server response containing the profile photo data. This can be a dictionary with metadata or raw image bytes.

Return type:

dict | bytes

await remove_user_account_request(language=MafiaLanguages.English)[source]

Sends a request to remove the user’s account.

This method sends a POST request to the server to initiate account removal, using the specified language for localization.

Parameters:

language (MafiaLanguages) – A MafiaLanguages enum value indicating the language to use in the request. Defaults to English.

Returns:

The server’s response to the account removal request, typically a dictionary or raw bytes depending on API implementation.

Return type:

dict | bytes

await sign_out()[source]

Signs the user out of the current session.

Sends a POST request to terminate the user’s active session on the server.

Returns:

The server’s response to the sign-out request, which may be a parsed JSON dictionary or raw response bytes.

Return type:

dict | bytes

await sign_up(email, password, username='', language=MafiaLanguages.English)[source]

Registers a new user account.

Sends a sign-up request to the server with email, password, and optional username.

Parameters:
  • email (str) – The user’s email address.

  • password (str) – The user’s password, which will be hashed before sending.

  • username (str, optional) – An optional display name for the user.

  • language (MafiaLanguages) – The preferred language for the account.

Returns:

The server’s response to the sign-up request, either as parsed JSON or raw bytes.

Return type:

dict | bytes

await user_get(user_id)[source]

Retrieves public information about a user by their ID.

Parameters:

user_id (str) – The unique identifier of the user.

Returns:

A dictionary with the user’s public profile data, or raw bytes if the response is not in JSON format.

Return type:

dict | bytes

await verify_email(language=MafiaLanguages.English)[source]

Sends a verification email to the user’s address.

Parameters:

language (MafiaLanguages) – The preferred language for the email content.

Returns:

The server’s response containing status or raw response bytes.

Return type:

dict[str, str] | bytes