async def test_fixture_test_client_raise_exception_for_non_sanic_app( test_client): aiohttp_web = Application() with pytest.raises(TypeError): await test_client(aiohttp_web)
def test_run_app(loop, unused_port): app = Application() port = unused_port() Process(target=kill_parent_soon, args=(os.getpid(), )).start() run_app(app, port, loop)
if args.shardcount == None and (args.min or args.max): raise Exception("You set a min/max shard handler but no shard count") bot = CustomBot( config_file=args.config_file, activity=Game(name="Reconnecting..."), status=Status.dnd, case_insensitive=True, shard_count=args.shardcount, shard_ids=shard_ids, shard_id=args.min, max_messages=100, fetch_offline_members=False, ) # Create website object - this is used for the webhook handler app = Application(loop=bot.loop, debug=True) app.add_routes(api_routes) app.router.add_static('/static', getcwd() + '/website/static') app['bot'] = bot app['static_root_url'] = '/static' jinja_setup(app, loader=FileSystemLoader(getcwd() + '/website/templates')) session_setup(app, ECS(token_bytes(32))) if __name__ == '__main__': ''' Starts the bot (and webserver if specified) and runs forever ''' # Grab the event loop loop = bot.loop
def app(router): return Application(router=router)
def application(handler, socket_path): app = Application() app.router.add_route("*", socket_path, handler) return app
def start_server(loop): app = Application() app.router.add_route(*handler.route) srv = yield from loop.create_server(app.make_handler(), "localhost", 9000) return srv
def function2688(): return Application(debug=True)
def function1121(): return Application()
async def init(loop): app = Application(loop=loop) app['sockets'] = [] app.router.add_get('/', wshandler) app.on_shutdown.append(on_shutdown) return app