예제 #1
0
파일: Dibbler.py 프로젝트: Xodarap/Eipi
def runTestServer(readyEvent=None):
    """Runs the calendar server example, with an added `/shutdown` URL."""
    import Dibbler, calendar
    class Calendar(Dibbler.HTTPPlugin):
        _form = '''<html><body><h3>Calendar Server</h3>
                   <form action='/'>
                   Year: <input type='text' name='year' size='4'>
                   <input type='submit' value='Go'></form>
                   <pre>%s</pre></body></html>'''

        def onHome(self, year=None):
            if year:
                result = calendar.calendar(int(year))
            else:
                result = ""
            self.writeOKHeaders('text/html')
            self.write(self._form % result)

        def onShutdown(self):
            self.writeOKHeaders('text/html')
            self.write("<html><body><p>OK.</p></body></html>")
            self.close()
            sys.exit()

    httpServer = Dibbler.HTTPServer(8888)
    httpServer.register(Calendar())
    if readyEvent:
        # Tell the self-test code that the test server is up and running.
        readyEvent.set()
    Dibbler.run(launchBrowser=True)
                        filename=config.LOG_FILE,
                        filemode='a+')

#from EmailSearchFrontend import EmailSearchFrontend

#start the smtp proxies

if len(config.SMTP_PROXY) > 0:

    for smtp_proxy_config in config.SMTP_PROXY:
        listener = smtp_proxy.BayesSMTPProxyListener(smtp_proxy_config[0],smtp_proxy_config[1],smtp_proxy_config[2])
    

#start the POP proxies

if len(config.POP_PROXY) > 0:

    for pop_proxy_config in config.POP_PROXY:
        listener = pop3_proxy.BayesProxyListener(pop_proxy_config[0],pop_proxy_config[1],pop_proxy_config[2])

#httpServer = Dibbler.HTTPServer(8081)
#httpServer.register(EmailSearchFrontend())

Dibbler.run()





    
예제 #3
0
def run():
    listener = BayesSMTPProxyListener('mail.asix.com.my',25,8125)
    Dibbler.run()