pjmakey2

twisted_server

Dec 5th, 2012
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  1. from twisted.application import service, internet
  2. from twisted.spread import pb
  3. from twisted.internet import reactor
  4. import os
  5.  
  6. class BkpHelp(pb.Root):
  7.     def remote_get_files(self):
  8.         tmp = []
  9.         for fp, rp, fi in os.walk('/var/datos/sisprop/ARCHIVOS'):
  10.             for arc in fi:
  11.                 fpath =  '%s/%s' % (fp, arc)
  12.                 tmp.append((fpath, arc))
  13.         return tmp
  14.  
  15.  
  16. class BkpHelpService(internet.TCPServer):
  17.     """                                                                                                                                                                  
  18.    use to launch twisted like a daemon                                                                                                                                  
  19.    """
  20.     def __init__(self):
  21.         internet.TCPServer.__init__(self,8800,pb.PBServerFactory(BkpHelp()))
Advertisement
Add Comment
Please, Sign In to add comment