aiospamc.headers module

Collection of request and response headers.

class aiospamc.headers.Compress

Bases: aiospamc.headers.Header

Compress header. Specifies what encryption scheme to use. So far only ‘zlib’ is supported.

zlib

bool – True if the zlib compression algorithm is used.

field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.ContentLength(length=0)

Bases: aiospamc.headers.Header

ContentLength header. Indicates the length of the body in bytes.

length

int – Length of the body.

__init__(length=0)

ContentLength constructor.

Parameters:length (int, optional) – Length of the body.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.DidRemove(action=None)

Bases: aiospamc.headers._SetRemoveBase

DidRemove header. Used by SPAMD to indicate if a message was removed from either a local or remote database in response to a TELL request.

action

aiospamc.options.ActionOption – Actions to be done on local or remote.

__init__(action=None)

_SetRemoveBase constructor.

Parameters:action (aiospamc.options.ActionOption, optional) – Actions to be done on local or remote.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.DidSet(action=None)

Bases: aiospamc.headers._SetRemoveBase

DidRemove header. Used by SPAMD to indicate if a message was added to either a local or remote database in response to a TELL request.

action

aiospamc.options.ActionOption – Actions to be done on local or remote.

__init__(action=None)

_SetRemoveBase constructor.

Parameters:action (aiospamc.options.ActionOption, optional) – Actions to be done on local or remote.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.Header

Bases: object

Header base class.

field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.MessageClass(value=None)

Bases: aiospamc.headers.Header

MessageClass header. Used to specify whether a message is ‘spam’ or ‘ham.’

value

aiospamc.options.MessageClassOption – Specifies the classification of the message.

__init__(value=None)

MessageClass constructor.

Parameters:value (aiospamc.options.MessageClassOption, optional) – Specifies the classification of the message.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.Remove(action=None)

Bases: aiospamc.headers._SetRemoveBase

Remove header. Used in a TELL request to ask the SPAMD service remove a message from a local or remote database. The SPAMD service must have the –allow-tells switch in order for this to do anything.

action

aiospamc.options.ActionOption – Actions to be done on local or remote.

__init__(action=None)

_SetRemoveBase constructor.

Parameters:action (aiospamc.options.ActionOption, optional) – Actions to be done on local or remote.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.Set(action=None)

Bases: aiospamc.headers._SetRemoveBase

Set header. Used in a TELL request to ask the SPAMD service add a message from a local or remote database. The SPAMD service must have the –allow-tells switch in order for this to do anything.

action

aiospamc.options.ActionOption – Actions to be done on local or remote.

__init__(action=None)

_SetRemoveBase constructor.

Parameters:action (aiospamc.options.ActionOption, optional) – Actions to be done on local or remote.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.Spam(value=False, score=0.0, threshold=0.0)

Bases: aiospamc.headers.Header

Spam header. Used by the SPAMD service to report on if the submitted message was spam and the score/threshold that it used.

value

bool – True if the message is spam, False if not.

score

float – Score of the message after being scanned.

threshold

float – Threshold of which the message would have been marked as spam.

__init__(value=False, score=0.0, threshold=0.0)

Spam header constructor.

Parameters:
  • value (bool, optional) – True if the message is spam, False if not.
  • score (float, optional) – Score of the message after being scanned.
  • threshold (float, optional) – Threshold of which the message would have been marked as spam.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.User(name=None)

Bases: aiospamc.headers.Header

User header. Used to specify which user the SPAMD service should use when loading configuration files.

name

str – Name of the user account.

__init__(name=None)

User constructor.

Parameters:name (str, optional) – Name of the user account.
field_name()

Returns the the field name for the header.

Returns:
Return type:str
class aiospamc.headers.XHeader(name, value)

Bases: aiospamc.headers.Header

Extension header. Used to specify a header that’s not supported natively by the SPAMD service.

name

str – Name of the header.

value

str – Contents of the value.

__init__(name, value)

XHeader constructor.

Parameters:
  • name (str) – Name of the header.
  • value (str) – Contents of the value.
field_name()

Returns the the field name for the header.

Returns:
Return type:str