malix.utils package

Submodules

malix.utils.Methods module

malix.utils.Methods.delete_account(Id, token: str)

Deletes the account resource.

malix.utils.Methods.delete_message(Id: str, token: str)

Deletes the message resource.

malix.utils.Methods.download_message(Id: str, token: str, path: Optional[str] = None)

Downloads the message.

malix.utils.Methods.get_account(Id: str, token: str)

Retrives the resource of an account.

malix.utils.Methods.get_domain(Id: str)

Retrives resource of a specific domain id.

malix.utils.Methods.get_domain_collection(domains_only: bool = False)

Retrives collection of domains.

malix.utils.Methods.get_message(Id: str, token: str)

Retrives the available messages for the respective source.

malix.utils.Methods.get_message_collection(token: str)

Retrives the collection resource.

malix.utils.Methods.get_my_account(token: str)

Retrives the resource for an logged in account.

malix.utils.Methods.get_sources(Id: str, token: str)

Returns the available sources for the respective Id.

malix.utils.Methods.make_account(address: Optional[str] = None, password: Optional[str] = None)

Creates a resource for an account.

malix.utils.Methods.update_message(Id: str, token: str)

Updates message resource.

malix.utils.attributes module

class malix.utils.attributes.Account(data: dict)
json

Formatted reponse(str).

response

Raw response(dict).

id

Id of the account.

adress

Adress of the account.

isDisabled

Tells whether the account is disabled or not.

isDeleted

Tells whether the account is deleted or not.

quota

Honestly, don’t know.! may become useful in the future.

used

Tells how many times used.

createdAt

Tells when the account resource was created.

updatedAt

Tells when the account resource was updated.

class malix.utils.attributes.Domain(data: dict)
json

Formatted reponse(str).

response

Raw response(dict).

id

Id of the domain.

domain

domain of the Domain object.

isActive

Tells whether the domain is still active or not.

isPrivate

Tells whether the domain has been protected or not.

createdAt

Tells when the domain resource was created.

updatedAt

Tells when the domain resource was updated.

class malix.utils.attributes.Message(data: dict)
json

Formatted reponse(str).

response

Raw response(dict).

id

Id of the message.

accountId

Account id of the cleint.

From

Dictonary containing address and name of the sender.

To

Dictonary containing address and name(will be hidden) of the receiver.

CC

don’t know ¯_(ツ)_/¯

BCC

don’t know ¯_(ツ)_/¯

subject

subject of the message.

seen

True if seen is updated using update_message.

flagged

Tells whether the message has been flagged or not.

isDeleted

True if the message resource has been deleted.

verifications

verifications list.

retention

True if the message is still retained.

retentionDate

The date of retention.

text

Text of the message.

html

html of the message.

hasAttachments

True if the message contains attachments.

attachments

The attachments of the message.

size

size of the message in Bytes.

downloadUrl

The download url of the message.

createdAt

Tells when the message resource was created.

updatedAt

Tells when the message resource was updated.

class malix.utils.attributes.Token(data: dict)
id

Id of the account.

token

Token of the account.

json

Formatted reponse(str).

response

Raw response(dict).

malix.utils.exceptions module

exception malix.utils.exceptions.AccessDenied(*args)

Bases: Exception

Raises when the client doesn’t have the rights to perform some specific operations.

  • code: 403

exception malix.utils.exceptions.Error(*args)

Bases: Exception

Base class of Error.

exception malix.utils.exceptions.InvalidCredentials(*args)

Bases: malix.utils.exceptions.Error

Raises when given credentials are invalid.

  • code: 401

exception malix.utils.exceptions.InvalidInput(*args)

Bases: malix.utils.exceptions.Error

Raises when either address or password is invalid.

  • code: 400

exception malix.utils.exceptions.NotAuthorized(*args)

Bases: Exception

Raises When the client isn’t authorized.

  • code: 401

exception malix.utils.exceptions.ResourceNotFound(*args)

Bases: malix.utils.exceptions.Error

Raises when there is no account resource belongs the respective credentials.

  • code : 404

exception malix.utils.exceptions.UnprocessableEntity(*args)

Bases: malix.utils.exceptions.Error

Raises when no valid inputs are given.

  • code: 422

malix.utils.headers module

class malix.utils.headers.Header(token: Optional[str] = None)

Bases: object

Header class of MalixMail.

Parameters

token – Token of the account.

Type

str

header
  • if token is None

    {
        "Content-Type": "application/ld+json",
        "accept": "application/ld+json"
    }
    
  • if token is provided

    {
        "Content-Type": "application/ld+json",
        "accept": "application/ld+json",
        "Authorization": "bearer"+token
    }
    

malix.utils.jwtoken module

malix.utils.jwtoken.get_token(address: Optional[str] = None, password: Optional[str] = None)

Returns a Token object for the given credentials.

Parameters
  • address (str) – Address of the account.

  • password (str) – Passowrd of the account.

Returns

Token object

Raises

InvalidCredentials – Raises when given credentials are invalid.