pyzor.client¶
Networked spam-signature detection client.
>>> import pyzor
>>> import pyzor.client
>>> import pyzor.digest
>>> import pyzor.config
To load the accounts file:
>>> accounts = pyzor.config.load_accounts(filename)
To create a client (to then issue commands):
>>> client = pyzor.client.Client(accounts)
To create a client, using the anonymous user:
>>> client = pyzor.client.Client()
To get a digest (of an email.message.Message object, or similar):
>>> digest = pyzor.digest.get_digest(msg)
To query a server (where address is a (host, port) pair):
>>> client.ping(address)
>>> client.info(digest, address)
>>> client.report(digest, address)
>>> client.whitelist(digest, address)
>>> client.check(digest, address)
To query the default server (public.pyzor.org):
>>> client.ping()
>>> client.info(digest)
>>> client.report(digest)
>>> client.whitelist(digest)
>>> client.check(digest)
Response will contain, depending on the type of request, some of the following keys (e.g. client.ping()[‘Code’]):
All responses will have: - ‘Diag’ ‘OK’ or error message - ‘Code’ ‘200’ if OK - ‘PV’ Protocol Version - ‘Thread’
info and check responses will also contain: - ‘[WL-]Count’ Whitelist/Blacklist count
info responses will also have: - ‘[WL-]Entered’ timestamp when message was first whitelisted/blacklisted - ‘[WL-]Updated’ timestamp when message was last whitelisted/blacklisted
-
class
pyzor.client.
BatchClient
(accounts=None, timeout=None, spec=None, batch_size=10)[source]¶ Bases:
pyzor.client.Client
Like the normal Client but with support for batching reports.
-
class
pyzor.client.
CheckClientRunner
(routine, r_count=0, wl_count=0)[source]¶ Bases:
pyzor.client.ClientRunner
-
class
pyzor.client.
Client
(accounts=None, timeout=None, spec=None)[source]¶ Bases:
object
-
max_packet_size
= 8192¶
-
timeout
= 5¶
-
-
class
pyzor.client.
InfoClientRunner
(routine)[source]¶ Bases:
pyzor.client.ClientRunner