def publish_apis(self, path='<STR_LIT>'):
assert path<EOL>if not self.apis:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>proto = '<STR_LIT:http>'<EOL>if hasattr(get_config(), '<STR_LIT>'):<EOL><INDENT>proto = '<STR_LIT>'<EOL><DEDENT>live_host = "<STR_LIT>" % (proto, get_config().live_host)<EOL>CORS(self.app, resources={r"<STR_LIT>" % path: {"<STR_LIT>": "<STR_LIT:*>"}})<EOL>for api_name, api_path in self.apis.items():<EOL><INDENT>api_filename = os.path.basename(api_path)<EOL>log.info("<STR_LIT>" % (api_name, path, api_name))<EOL>def redirect_to_petstore(live_host, api_filename):<EOL><INDENT>def f():<EOL><INDENT>url = '<STR_LIT>' % (live_host, path, api_filename)<EOL>log.info("<STR_LIT>" % url)<EOL>return redirect(url, code=<NUM_LIT>)<EOL><DEDENT>return f<EOL><DEDENT>def serve_api_spec(api_path):<EOL><INDENT>def f():<EOL><INDENT>with open(api_path, '<STR_LIT:r>') as f:<EOL><INDENT>spec = f.read()<EOL>log.info("<STR_LIT>" % api_path)<EOL>return Response(spec, mimetype='<STR_LIT>')<EOL><DEDENT><DEDENT>return f<EOL><DEDENT>self.app.add_url_rule('<STR_LIT>' % (path, api_name), str(uuid4()), redirect_to_petstore(live_host, api_filename))<EOL>self.app.add_url_rule('<STR_LIT>' % (path, api_filename), str(uuid4()), serve_api_spec(api_path))<EOL><DEDENT>return self<EOL>
Publish all loaded apis on under the uri /<path>/<api-name>, by
        redirecting to http://petstore.swagger.io/