def __init__(self) -> None: """Initializes the backend server May raise: - SystemPermissionError due to the given args containing a datadir that does not have the correct permissions """ arg_parser = app_args( prog='rotki', description= ('Rotki, the portfolio tracker and accounting tool that respects your privacy' ), ) self.args = arg_parser.parse_args() self.rotkehlchen = Rotkehlchen(self.args) self.stop_event = gevent.event.Event() domain_list = [] if self.args.api_cors: if "," in self.args.api_cors: for domain in self.args.api_cors.split(","): domain_list.append(str(domain)) else: domain_list.append(str(self.args.api_cors)) self.api_server = APIServer( rest_api=RestAPI(rotkehlchen=self.rotkehlchen), cors_domain_list=domain_list, )
def create_api_server(rotki: Rotkehlchen, port_number: int) -> APIServer: api_server = APIServer(RestAPI(rotkehlchen=rotki)) api_server.flask_app.config["SERVER_NAME"] = f"localhost:{port_number}" api_server.start(host='127.0.0.1', port=port_number) # Fixes flaky test, were requests are done prior to the server initializing # the listening socket. # https://github.com/raiden-network/raiden/issues/389#issuecomment-305551563 _wait_for_listening_port(port_number) return api_server
def __init__(self) -> None: arg_parser = app_args( prog='rotki', description= ('Rotki, the portfolio tracker and accounting tool that respects your privacy' ), ) self.args = arg_parser.parse_args() self.rotkehlchen = Rotkehlchen(self.args) self.stop_event = gevent.event.Event() domain_list = [] if self.args.api_cors: if "," in self.args.api_cors: for domain in self.args.api_cors.split(","): domain_list.append(str(domain)) else: domain_list.append(str(self.args.api_cors)) self.api_server = APIServer( rest_api=RestAPI(rotkehlchen=self.rotkehlchen), cors_domain_list=domain_list, )