| Current Path : /lib/python2.7/site-packages/pyzor/ |
| Current File : //lib/python2.7/site-packages/pyzor/client.pyc |
� �}Iec @ s d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z e j j j � d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d S( sy 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.DataDigester(msg).value 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 i����Nt Clientc B s� e Z d Z d Z d d d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z e d � � Z d � Z RS( i i c C s� | d k r i } n t d � | j � D� � | _ | d k rO t j j } n | | _ | d k rp | | _ n t j d � | _ d S( Nc s s3 | ]) \ \ } } } | t | � f | f Vq d S( N( t int( t .0t hostt portt account( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pys <genexpr>P s t pyzor( t Nonet dictt itemst accountsR t digestt digest_spect spect timeoutt loggingt getLoggert log( t selfR R R ( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pyt __init__M s s public.pyzor.orgiy_ c C s7 t j j � } | j | | � } | j | | j � � S( N( R t messaget PingRequestt sendt read_responset get_thread( R t addresst msgt sock( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pyt pingY s c C s: t j j | � } | j | | � } | j | | j � � S( N( R R t PongRequestR R R ( R R R R R ( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pyt pong^ s c C s: t j j | � } | j | | � } | j | | j � � S( N( R R t InfoRequestR R R ( R R R R R ( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pyt infoc s c C s@ t j j | | j � } | j | | � } | j | | j � � S( N( R R t ReportRequestR R R R ( R R R R R ( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pyt reporth s c C s@ t j j | | j � } | j | | � } | j | | j � � S( N( R R t WhitelistRequestR R R R ( R R R R R ( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pyt whitelistm s c C s: t j j | � } | j | | � } | j | | j � � S( N( R R t CheckRequestR R R ( R R R R R ( ( s0 /usr/lib/python2.7/site-packages/pyzor/client.pyt checkr s c C s>