我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用net.validaddr()。
def runwsgi(func, app): """ Runs a WSGI-compatible `func` using FCGI, SCGI, or a simple web server, as appropriate based on context and `sys.argv`. """ if os.environ.has_key('SERVER_SOFTWARE'): # cgi os.environ['FCGI_FORCE_CGI'] = 'Y' if (os.environ.has_key('PHP_FCGI_CHILDREN') #lighttpd fastcgi or os.environ.has_key('SERVER_SOFTWARE')): return runfcgi(func, None) if 'fcgi' in sys.argv or 'fastcgi' in sys.argv: args = sys.argv[1:] if 'fastcgi' in args: args.remove('fastcgi') elif 'fcgi' in args: args.remove('fcgi') if args: return runfcgi(func, validaddr(args[0])) else: return runfcgi(func, None) if 'scgi' in sys.argv: args = sys.argv[1:] args.remove('scgi') if args: return runscgi(func, validaddr(args[0])) else: return runscgi(func) return httpserver.runsimple(func, app, validip(listget(sys.argv, 1, '')))
def runwsgi(func): """ Runs a WSGI-compatible `func` using FCGI, SCGI, or a simple web server, as appropriate based on context and `sys.argv`. """ if os.environ.has_key('SERVER_SOFTWARE'): # cgi os.environ['FCGI_FORCE_CGI'] = 'Y' if (os.environ.has_key('PHP_FCGI_CHILDREN') #lighttpd fastcgi or os.environ.has_key('SERVER_SOFTWARE')): return runfcgi(func, None) if 'fcgi' in sys.argv or 'fastcgi' in sys.argv: args = sys.argv[1:] if 'fastcgi' in args: args.remove('fastcgi') elif 'fcgi' in args: args.remove('fcgi') if args: return runfcgi(func, validaddr(args[0])) else: return runfcgi(func, None) if 'scgi' in sys.argv: args = sys.argv[1:] args.remove('scgi') if args: return runscgi(func, validaddr(args[0])) else: return runscgi(func) return httpserver.runsimple(func, validip(listget(sys.argv, 1, '')))