@@ -29,7 +29,7 @@ <h1 class="title">Module <code>livechat.agent.rtm.api.v33</code></h1>
29
29
</ summary >
30
30
< pre > < code class ="python "> ''' Module containing Agent RTM API client implementation for v3.3. '''
31
31
32
- from typing import Any, Optional, Union
32
+ from typing import Any, Callable, Optional, Union
33
33
34
34
from livechat.utils.helpers import prepare_payload
35
35
from livechat.utils.structures import AccessToken, RtmResponse
@@ -40,15 +40,21 @@ <h1 class="title">Module <code>livechat.agent.rtm.api.v33</code></h1>
40
40
41
41
class AgentRtmV33:
42
42
''' Agent RTM API Class containing methods in version 3.3. '''
43
- def __init__(self, url: str):
44
- self.ws = WebsocketClient(url=f'wss://{url}/v3.3/agent/rtm/ws')
43
+ def __init__(
44
+ self,
45
+ url: str,
46
+ header: Union[list, dict, Callable, None],
47
+ ):
48
+ self.ws = WebsocketClient(url=f'wss://{url}/v3.3/agent/rtm/ws',
49
+ header=header)
45
50
46
51
def open_connection(self,
47
52
origin: dict = None,
48
- ping_timeout: float = 3,
49
- ping_interval: float = 5,
50
- ws_conn_timeout: float = 10,
51
- keep_alive: bool = True) -> None:
53
+ ping_timeout: Union[float, int] = 3,
54
+ ping_interval: Union[float, int] = 5,
55
+ ws_conn_timeout: Union[float, int] = 10,
56
+ keep_alive: bool = True,
57
+ response_timeout: Union[float, int] = 3) -> None:
52
58
''' Opens WebSocket connection.
53
59
54
60
Args:
@@ -60,9 +66,11 @@ <h1 class="title">Module <code>livechat.agent.rtm.api.v33</code></h1>
60
66
ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
61
67
by default sets to 10 seconds.
62
68
keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
69
+ response_timeout (int or float): timeout (in seconds) to wait for the response,
70
+ by default sets to 3 seconds.
63
71
'''
64
72
self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
65
- keep_alive)
73
+ keep_alive, response_timeout )
66
74
67
75
def close_connection(self) -> None:
68
76
''' Closes WebSocket connection. '''
@@ -1067,7 +1075,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1067
1075
< dl >
1068
1076
< dt id ="livechat.agent.rtm.api.v33.AgentRtmV33 "> < code class ="flex name class ">
1069
1077
< span > class < span class ="ident "> AgentRtmV33</ span > </ span >
1070
- < span > (</ span > < span > url: str)</ span >
1078
+ < span > (</ span > < span > url: str, header: Union[list, dict, Callable, None] )</ span >
1071
1079
</ code > </ dt >
1072
1080
< dd >
1073
1081
< div class ="desc "> < p > Agent RTM API Class containing methods in version 3.3.</ p > </ div >
@@ -1077,15 +1085,21 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1077
1085
</ summary >
1078
1086
< pre > < code class ="python "> class AgentRtmV33:
1079
1087
''' Agent RTM API Class containing methods in version 3.3. '''
1080
- def __init__(self, url: str):
1081
- self.ws = WebsocketClient(url=f'wss://{url}/v3.3/agent/rtm/ws')
1088
+ def __init__(
1089
+ self,
1090
+ url: str,
1091
+ header: Union[list, dict, Callable, None],
1092
+ ):
1093
+ self.ws = WebsocketClient(url=f'wss://{url}/v3.3/agent/rtm/ws',
1094
+ header=header)
1082
1095
1083
1096
def open_connection(self,
1084
1097
origin: dict = None,
1085
- ping_timeout: float = 3,
1086
- ping_interval: float = 5,
1087
- ws_conn_timeout: float = 10,
1088
- keep_alive: bool = True) -> None:
1098
+ ping_timeout: Union[float, int] = 3,
1099
+ ping_interval: Union[float, int] = 5,
1100
+ ws_conn_timeout: Union[float, int] = 10,
1101
+ keep_alive: bool = True,
1102
+ response_timeout: Union[float, int] = 3) -> None:
1089
1103
''' Opens WebSocket connection.
1090
1104
1091
1105
Args:
@@ -1097,9 +1111,11 @@ <h2 class="section-title" id="header-classes">Classes</h2>
1097
1111
ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
1098
1112
by default sets to 10 seconds.
1099
1113
keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
1114
+ response_timeout (int or float): timeout (in seconds) to wait for the response,
1115
+ by default sets to 3 seconds.
1100
1116
'''
1101
1117
self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
1102
- keep_alive)
1118
+ keep_alive, response_timeout )
1103
1119
1104
1120
def close_connection(self) -> None:
1105
1121
''' Closes WebSocket connection. '''
@@ -3303,7 +3319,7 @@ <h2 id="returns">Returns</h2>
3303
3319
</ details >
3304
3320
</ dd >
3305
3321
< dt id ="livechat.agent.rtm.api.v33.AgentRtmV33.open_connection "> < code class ="name flex ">
3306
- < span > def < span class ="ident "> open_connection</ span > </ span > (< span > self, origin: dict = None, ping_timeout: float = 3, ping_interval: float = 5, ws_conn_timeout: float = 10, keep_alive: bool = True) ‑> None</ span >
3322
+ < span > def < span class ="ident "> open_connection</ span > </ span > (< span > self, origin: dict = None, ping_timeout: Union[ float, int] = 3, ping_interval: Union[ float, int] = 5, ws_conn_timeout: Union[ float, int] = 10, keep_alive: bool = True, response_timeout: Union[float, int] = 3 ) ‑> None</ span >
3307
3323
</ code > </ dt >
3308
3324
< dd >
3309
3325
< div class ="desc "> < p > Opens WebSocket connection.</ p >
@@ -3320,18 +3336,22 @@ <h2 id="args">Args</h2>
3320
3336
< dt > < strong > < code > ws_conn_timeout</ code > </ strong > : < code > int</ code > or < code > float</ code > </ dt >
3321
3337
< dd > timeout (in seconds) to wait for WebSocket connection,
3322
3338
by default sets to 10 seconds.</ dd >
3323
- </ dl >
3324
- < p > keep_alive(bool): Bool which states if connection should be kept, by default sets to < code > True</ code > .</ p > </ div >
3339
+ < dt > keep_alive(bool): Bool which states if connection should be kept, by default sets to < code > True</ code > .</ dt >
3340
+ < dt > < strong > < code > response_timeout</ code > </ strong > : < code > int</ code > or < code > float</ code > </ dt >
3341
+ < dd > timeout (in seconds) to wait for the response,
3342
+ by default sets to 3 seconds.</ dd >
3343
+ </ dl > </ div >
3325
3344
< details class ="source ">
3326
3345
< summary >
3327
3346
< span > Expand source code</ span >
3328
3347
</ summary >
3329
3348
< pre > < code class ="python "> def open_connection(self,
3330
3349
origin: dict = None,
3331
- ping_timeout: float = 3,
3332
- ping_interval: float = 5,
3333
- ws_conn_timeout: float = 10,
3334
- keep_alive: bool = True) -> None:
3350
+ ping_timeout: Union[float, int] = 3,
3351
+ ping_interval: Union[float, int] = 5,
3352
+ ws_conn_timeout: Union[float, int] = 10,
3353
+ keep_alive: bool = True,
3354
+ response_timeout: Union[float, int] = 3) -> None:
3335
3355
''' Opens WebSocket connection.
3336
3356
3337
3357
Args:
@@ -3343,9 +3363,11 @@ <h2 id="args">Args</h2>
3343
3363
ws_conn_timeout (int or float): timeout (in seconds) to wait for WebSocket connection,
3344
3364
by default sets to 10 seconds.
3345
3365
keep_alive(bool): Bool which states if connection should be kept, by default sets to `True`.
3366
+ response_timeout (int or float): timeout (in seconds) to wait for the response,
3367
+ by default sets to 3 seconds.
3346
3368
'''
3347
3369
self.ws.open(origin, ping_timeout, ping_interval, ws_conn_timeout,
3348
- keep_alive)</ code > </ pre >
3370
+ keep_alive, response_timeout )</ code > </ pre >
3349
3371
</ details >
3350
3372
</ dd >
3351
3373
< dt id ="livechat.agent.rtm.api.v33.AgentRtmV33.remove_user_from_chat "> < code class ="name flex ">
0 commit comments