def main(opts, args): if args[0] == 'lumi': import lumi lumi.main(opts, args[1:]) elif args[0] == 'compare': import compare compare.main(opts, args[1:]) elif args[0] == 'combine': import combine combine.main(opts, args[1:]) elif args[0] == 'divide': import divide divide.main(opts, args[1:]) elif args[0] == 'para': import para para.main(opts, args[1:]) elif args[0] == 'entries': import entries entries.main(opts, args[1:]) elif args[0] == 'brf': import brf brf.main(opts, args[1:]) elif args[0] == 'diff': import diff diff.main(opts, args[1:]) elif args[0] == 'cuts': import cuts cuts.main(opts, args[1:]) elif args[0] == 'parse': import parse parse.main(opts, args[1:]) elif args[0] == 'backgrounds': import backgrounds backgrounds.main(opts, args[1:]) elif args[0] == 'cbx': import cbx cbx.main(opts, args[1:]) elif args[0] == 'sld': import sld sld.main(opts, args[1:]) elif args[0] == 'web': import web web.main(opts, args[1:]) elif args[0] == 'mctruth': import mctruth mctruth.main(opts, args[1:]) elif args[0] == 'ths': import ths ths.main(opts, args[1:]) elif args[0] == 'prd': import prd prd.main(opts, args[1:]) else: raise NameError(args)
async def main(): shutdown_signal = asyncio.Event() modules = [] # start main bus LOG.info('Starting message bus') modules.append(create_task(bus.main(shutdown_signal))) # start user tracking LOG.info('Starting user tracking') modules.append(create_task(tracking.main(shutdown_signal))) # start wifi tracker LOG.info('Starting Wifi tracking') modules.append(create_task(wifi.main(shutdown_signal))) # start volumio control LOG.info('Starting volumio control') modules.append(create_task(audio.main(shutdown_signal))) # start web interface LOG.info('Starting web interface') modules.append(create_task(web.main(shutdown_signal))) # start mqtt LOG.info('Starting MQTT') modules.append(create_task(mqtt.main(shutdown_signal))) LOG.info('Done starting up') try: await asyncio.gather(*modules) except KeyboardInterrupt: shutdown_signal.set()
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import argparse parser = argparse.ArgumentParser(prog='kandu_server', description='Runs the web server. Open a browser at http://localhost:8888 (default port)') parser.add_argument("--port", help="Port", default=8888, required=False) parser.add_argument("--maxitems", dest='maxitems', default=500, type=int, help="How many files to preview", required=False) parser.add_argument("--repository", dest='repository', type=str, help="Repository folder", required=True) parser.add_argument("--hierarchy", dest='jsonfile', type=str, help="Output hierarchy json", required=True) parser.add_argument("--ignore", dest='ignorelist', type=str, default=None, help="File listing rules which matching files should be hidden from the preview", required=False) parser.add_argument("--sep", dest='separators', type=str, default="_", help="Characters to use as potential separators (includes slash by default)", required=False) args = parser.parse_args() from web import main main(args)
def main(): update() print("Starting webserver...") import threading threading.Timer(2, open_browser).start() web.main()
def scanner_web(ip, port): webScan = resources.web_scanner_config('GET', '/', ip) results = resources.netcat(ip, port, webScan) if results: web.main(ip, port, results)
def setUp(self): from web import main app = main({}) from webtest import TestApp self.testapp = TestApp(app)
parser.add_argument( '-extra_args', default = "", help='extra args to pass to mstate_contact_opt.py' ) parser.add_argument( '-web', action='store_true', help='Serve results website.' ) args = parser.parse_args() if args.web: from web import main main() log_id = uuid4().hex logging.basicConfig( level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M', filename='logs/' + log_id, filemode='w' ) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__file__) logger.setLevel(logging.DEBUG if args.verbose else logging.INFO)
def main(): args = parse_args() if args.debug: print("Arguments:%s" % args) web.main(args)
def main(): args = parse_args() if args.debug: print("Arguments:%s" % args) web.main(args.debug, args.static_dir, args.template_dir, args.listen)
@app.route('/test/<str:a>/<str:b>') @app.route('/test/<str:a>') def test_route_1(request, a, b=None): return send_json({'a': a, 'b': b}) @app.route('/test-int/<int:a>') def test_int_route(request, a): return send_json({'a': a, 'type': type(a).__name__}) test_index_tpl = Template(r''' <h1>Tests</h1> <ul> <li><a href="{{ app.url_for("test_route_1", a=4) }}">test_route_1(a=4)</a></li> <li><a href="{{ app.url_for("test_route_1", a=4, b=None) }}">test_route_1(a=4, b=None)</a></li> <li><a href="{{ app.url_for("test_route_1", a=4, b=6) }}">test_route_1(a=4, b=6)</a></li> <li><a href="{{ app.url_for("test_route_1", a=4, b=6, c=8) }}">test_route_1(a=4, b=6, c=8)</a></li> <li><a href="{{ app.url_for("test_int_route", a=4) }}">test_int_route(a=4)</a></li> <li><a href="{{ app.url_for("test_int_route", a="4") }}">test_int_route(a="4")</a></li> </ul> ''') @app.route('/') def test_index(request): return send_html(test_index_tpl, app=app) main(app)
""" liege is our general case wit.ai handler liege.web.py serves a HTTP user interface, and interacts directly with the Wit.ai API. You can POST to it at <host>:<port>/wit/ to submit a query. When the wit.ai call returns on the server, it sends a Squidwork message containing the result. The ui frontend subscribes to wit.ai result events so it can see those, too. liege.worker.py listens to wit.ai squidwork results and does things. The results of its operations are also broadcast as squidwork messages """ __author__ = '*****@*****.**' if __name__ == '__main__': from web import main() main()
import web if __name__ == '__main__': web.main()
def main(): """Run scraper and web server.""" car_scraper.main() web.main()
def main(): config = read_config() print 'Starting web server' web.main(index, int(config.get('web server', 'port')))