Debian Codegraph @

docs/core/examples/postfix.py

raw
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 Test app for PostfixTCPMapServer.
6
7 Call with parameters KEY1=VAL1 KEY2=VAL2 ...
8 """
9
10 import sys
11
12 from twisted.internet import reactor
13 from twisted.protocols import postfix
14 from twisted.python import log
15
16 log.startLogging(sys.stdout)
17
18 d = {}
19 for arg in sys.argv[1:]:
20 try:
21 k, v = arg.split("=", 1)
22 except ValueError:
23 k = arg
24 v = ""
25 d[k] = v
26
27 f = postfix.PostfixTCPMapDictServerFactory(d)
28 port = reactor.listenTCP(4242, f, interface="127.0.0.1")
29 reactor.run()