def __init__(self, control, host=None, port=None, max_workers=None):
        if host is None:
            host = config.get_string('koapy.backend.kiwoom_open_api_plus.grpc.host', 'localhost')
        if port is None:
            port = config.get('koapy.backend.kiwoom_open_api_plus.grpc.port')
        if port == 0:
            port = get_free_localhost_port()
        if max_workers is None:
            max_workers = config.get_int('koapy.backend.kiwoom_open_api_plus.grpc.server.max_workers', 8)

        self._control = control
        self._host = host
        self._port = port
        self._max_workers = max_workers

        self._address = self._host + ':' + str(self._port)
        self._servicer = KiwoomOpenApiPlusServiceServicer(self._control)
        self._executor = futures.ThreadPoolExecutor(max_workers=self._max_workers)

        self._server = None
        self._server_started = False
        self._server_stopped = False

        self.reinitialize_server()

        atexit.register(self._executor.shutdown, False)
    def __init__(self, host=None, port=None):
        self._host = host or config.get_string('koapy.backend.kiwoom_open_api_plus.grpc.host', 'localhost')
        self._port = port or config.get('koapy.backend.kiwoom_open_api_plus.grpc.port')

        if self._port is None:
            raise ValueError('Port is None')

        self._target = self._host + ':' + str(self._port)
        self._channel = grpc.insecure_channel(self._target)
        self._stub = KiwoomOpenApiPlusService_pb2_grpc.KiwoomOpenApiPlusServiceStub(self._channel)
        self._stub_wrapped = KiwoomOpenApiPlusServiceClientStubWrapper(self._stub)
Exemplo n.º 3
0
 def __init__(self, url=None):
     self._url = url or config.get_string(
         "koapy.utils.messaging.discord.webhook_url")
     assert self._url is not None and len(self._url) > 0
Exemplo n.º 4
0
 def __init__(self, url=None):
     self._url = url or config.get_string(
         "koapy.utils.messaging.discord.webhook_url")
     assert self._url is not None and len(self._url) > 0
     self._webhook = Webhook.from_url(self._url,
                                      adapter=RequestsWebhookAdapter())