Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wiseplat
GitHub Repository: wiseplat/python-code
Path: blob/master/ invest-robot-contest_TinkoffBotTwitch-main/venv/lib/python3.8/site-packages/tinkoff/invest/channels.py
7815 views
1
from typing import Any, Optional
2
3
import grpc
4
5
from .constants import INVEST_GRPC_API
6
from .typedefs import ChannelArgumentType
7
8
__all__ = ("create_channel",)
9
10
11
def create_channel(
12
*,
13
target: Optional[str] = None,
14
options: Optional[ChannelArgumentType] = None,
15
force_async: bool = False
16
) -> Any:
17
creds = grpc.ssl_channel_credentials()
18
target = target or INVEST_GRPC_API
19
args = (target, creds, options)
20
if force_async:
21
return grpc.aio.secure_channel(*args)
22
return grpc.secure_channel(*args)
23
24