本文整理汇总了Python中pyftpdlib.servers.FTPServer.ip_map方法的典型用法代码示例。如果您正苦于以下问题:Python FTPServer.ip_map方法的具体用法?Python FTPServer.ip_map怎么用?Python FTPServer.ip_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyftpdlib.servers.FTPServer
的用法示例。
在下文中一共展示了FTPServer.ip_map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: notification
# 需要导入模块: from pyftpdlib.servers import FTPServer [as 别名]
# 或者: from pyftpdlib.servers.FTPServer import ip_map [as 别名]
for tn in ['01','02','03','04','05','06','07','08','09','10']:
if (tfalse(addst(tn+"-enable","false"))==True):
tt={}; tt['path']=xbmc.validatePath(xbmc.translatePath(addst(tn+"-path","special://logpath"))) #.replace(pFindWhat,"|tag|").replace("|tag|",pReplaceWith)
tt['user']=addst(tn+"-user",""); tt['pass']=addst(tn+"-pass","xbmchub"); tt['perm']=addst(tn+"-perm","elradfmwM")
if (len(tt['user']) > 0) and (len(tt['path']) > 0):
print "user : "+str(tt['user'])+" : path :"+str(tt['path'])+" :"
try: authorizer.add_user(tt['user'],tt['pass'],tt['path'],perm=tt['perm'])
except: print"Error adding user: "+str(tt['user']); pass
handler=FTPHandler; handler.authorizer=authorizer; handler.banner="pyftpdlib based ftpd ready."
try: LiP=addst("address","")
except: LiP=""
try: Lport=int(addst("port","2121"))
except: Lport=2121
address=(LiP,Lport); server=FTPServer(address,handler); server.max_cons=int(addst("max-connections","5")); server.max_cons_per_ip=int(addst("max-connections-per-ip","5"));
print "Starting Server... Port: "+str(Lport); notification("FTP Server","Starting Server... Port: "+str(Lport))
#server.serve_forever()
try: server.serve_forever(timeout=int(addst("timeout","10")),blocking=False)
except: pass
elif (STARTUP==False) and (ENABLED==True):
try: server.serve_forever(timeout=int(addst("timeout","10")),blocking=False)
except: pass
print "Service While Loop has been exited."; print "isEnabled="+str(ENABLED); print "Attempting to Close Server...."; notification("FTP Server","Attempting to Close Server....")
addstv("is-serivce-running","false")
try: server.ip_map=[]
except: print "failed: server.ip_map=[]"; pass
try: server.socket.close()
except: print "failed: server.socket.close()"; pass
try: server.close_all()
except: pass
sys.exit()