Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def login_info(self) -> LoginInfo:
#TODO
return LoginInfo(
team=Team(
id='',
name='',
domain='',
),
self=Self(
id='',
name='LtWorf',
),
def __init__(self, token: str, cookie: Optional[str], previous_status: Optional[bytes]) -> None:
self.client = SlackClient(token, cookie)
self._usercache: Dict[str, User] = {}
self._usermapcache: Dict[str, User] = {}
self._usermapcache_keys: List[str]
self._imcache: Dict[str, str] = {}
self._channelscache: List[Channel] = []
self._get_members_cache: Dict[str, Set[str]] = {}
self._get_members_cache_cursor: Dict[str, Optional[str]] = {}
self._internalevents: List[SlackEvent] = []
self._sent_by_self: Set[float] = set()
self.login_info: Optional[LoginInfo] = None
if previous_status is None:
self._status = SlackStatus()
else:
self._status = load(json.loads(previous_status), SlackStatus)
Connects to the RTM API - https://api.slack.com/rtm
:Args:
timeout: in seconds
"""
# rtm.start returns user and channel info, rtm.connect does not.
connect_method = "rtm.connect"
reply = self._api_requester.do(connect_method, timeout=timeout, post_data=kwargs, files=None)
if reply.status_code != 200:
raise SlackConnectionError("RTM connection attempt failed")
login_data = reply.json()
if login_data["ok"]:
self._connect_slack_websocket(login_data['url'])
return load(login_data, LoginInfo)
else:
raise SlackLoginError(reply=login_data)