def load(args, tunnel_=False): """Start recording http requests.""" if Bullet.count(): if args.force: Bullet.remove_all() elif args.append: # Proper initialization of main clock. try: latest = Bullet.get_latest() offset = latest.time + 100 except NotFound: offset = 0 clock = MilisecondsClock(offset=offset) Clock.initialize(clock) else: print( "There are already records in database, use '--force' (Luke) " "to erase them, and start new recording, or '--append' " "to continue from 100 miliseconds after last recorded " "request.") exit(0) print('Started listening at port "{}"'.format(settings.config['port'])) app = tornado.web.Application( [(r'/.*', RecordHandler, {'tunnel': tunnel_})]) app.listen(settings.config['port']) loop = tornado.ioloop.IOLoop.instance() loop.start()