"Fossies" - the Fresh Open Source Software Archive 
Member "pyzor-1.0.0/pyzor/__init__.py" (10 Dec 2014, 1410 Bytes) of package /linux/privat/pyzor-1.0.0.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "__init__.py" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
0.9.0_vs_1.0.0.
1 """Networked spam-signature detection."""
2
3 __author__ = "Frank J. Tobin, ftobin@neverending.org"
4 __credits__ = "Tony Meyer, Dreas von Donselaar, all the Pyzor contributors."
5 __version__ = "1.0.0"
6
7 import hashlib
8
9 proto_name = 'pyzor'
10 proto_version = 2.1
11 anonymous_user = 'anonymous'
12
13 # We would like to use sha512, but that would mean that all the digests
14 # changed, so for now, we stick with sha1 (which is the same as the old
15 # sha module).
16 sha = hashlib.sha1
17
18 # This is the maximum time between a client signing a Pyzor request and the
19 # server checking the signature.
20 MAX_TIMESTAMP_DIFFERENCE = 300 # seconds
21
22
23 class CommError(Exception):
24 """Something in general went wrong with the transaction."""
25 code = 400
26
27
28 class ProtocolError(CommError):
29 """Something is wrong with talking the protocol."""
30 code = 400
31
32
33 class TimeoutError(CommError):
34 """The connection timed out."""
35 code = 504
36
37
38 class IncompleteMessageError(ProtocolError):
39 """A complete requested was not received."""
40 pass
41
42
43 class UnsupportedVersionError(ProtocolError):
44 """Client is using an unsupported protocol version."""
45 pass
46
47
48 class SignatureError(CommError):
49 """Unknown user, signature on msg invalid, or not within allowed time
50 range."""
51 pass
52
53
54 class AuthorizationError(CommError):
55 """The signature was valid, but the user is not permitted to do the
56 requested action."""
57 pass