33# pylint: disable=W0613,W0622,C0103,R0913,R0903,W0107,W0221
44from __future__ import annotations
55
6- from typing import Union
6+ from typing import Callable , Union
77
88from livechat .agent .rtm .api .v33 import AgentRtmV33
99from livechat .agent .rtm .api .v34 import AgentRtmV34
@@ -20,13 +20,16 @@ class AgentRTM:
2020 @staticmethod
2121 def get_client (
2222 version : str = stable_version ,
23- base_url : str = api_url
23+ base_url : str = api_url ,
24+ header : Union [list , dict , Callable , None ] = None ,
2425 ) -> Union [AgentRtmV33 , AgentRtmV34 , AgentRtmV35 , AgentRtmV36 ]:
2526 ''' Returns client for specific Agent RTM version.
2627
2728 Args:
2829 version (str): API's version. Defaults to the stable version of API.
2930 base_url (str): API's base url. Defaults to API's production URL.
31+ header (Union[list, dict, Callable, None]): Custom header for websocket handshake.
32+ If the parameter is a callable object, it is called just before the connection attempt.
3033
3134 Returns:
3235 API client object for specified version.
@@ -42,4 +45,4 @@ def get_client(
4245 }.get (version )
4346 if not client :
4447 raise ValueError ('Provided version does not exist.' )
45- return client (base_url )
48+ return client (base_url , header )
0 commit comments