Source code for ubdcc_restapi.RestApi

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ¯\_(ツ)_/¯
#
# File: packages/ubdcc-restapi/ubdcc_restapi/RestApi.py
#
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-depth-cache-cluster
# Github: https://github.com/oliver-zehentleitner/unicorn-binance-depth-cache-cluster
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-depth-cache-cluster
# PyPI: https://pypi.org/project/ubdcc-restapi
#
# License: MIT
# https://github.com/oliver-zehentleitner/unicorn-binance-depth-cache-cluster/blob/master/LICENSE
#
# Author: Oliver Zehentleitner
#
# Copyright (c) 2024-2026, Oliver Zehentleitner (https://about.me/oliver-zehentleitner)
# All rights reserved.

from .RestEndpoints import RestEndpoints
from ubdcc_shared_modules.ServiceBase import ServiceBase


[docs] class RestApi(ServiceBase): def __init__(self, cwd=None, mgmt_port=None): super().__init__(app_name="ubdcc-restapi", cwd=cwd, mgmt_port=mgmt_port)
[docs] async def main(self): await self.start_rest_server(endpoints=RestEndpoints) self.app.set_status_running() await self.app.register_or_restart() self.db_init() while self.app.is_shutdown() is False: await self.app.sleep() await self.app.ubdcc_node_sync()