webex-bot 0.6.0__py2.py3-none-any.whl → 0.6.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- webex_bot/__init__.py +1 -1
- webex_bot/websockets/webex_websocket_client.py +25 -4
- {webex_bot-0.6.0.dist-info → webex_bot-0.6.1.dist-info}/METADATA +7 -1
- {webex_bot-0.6.0.dist-info → webex_bot-0.6.1.dist-info}/RECORD +7 -7
- {webex_bot-0.6.0.dist-info → webex_bot-0.6.1.dist-info}/WHEEL +1 -1
- {webex_bot-0.6.0.dist-info → webex_bot-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {webex_bot-0.6.0.dist-info → webex_bot-0.6.1.dist-info}/top_level.txt +0 -0
webex_bot/__init__.py
CHANGED
|
@@ -10,6 +10,7 @@ import certifi
|
|
|
10
10
|
import requests
|
|
11
11
|
import websockets
|
|
12
12
|
from webexpythonsdk import WebexAPI
|
|
13
|
+
from websockets.exceptions import InvalidStatusCode
|
|
13
14
|
|
|
14
15
|
try:
|
|
15
16
|
from websockets_proxy import Proxy, proxy_connect
|
|
@@ -193,6 +194,9 @@ class WebexWebsocketClient(object):
|
|
|
193
194
|
logger.error('could not get/create device info')
|
|
194
195
|
raise Exception("No WDM device info")
|
|
195
196
|
|
|
197
|
+
# Pull out URL now so we can log it on failure
|
|
198
|
+
ws_url = self.device_info.get('webSocketUrl')
|
|
199
|
+
|
|
196
200
|
async def _websocket_recv():
|
|
197
201
|
message = await self.websocket.recv()
|
|
198
202
|
logger.debug("WebSocket Received Message(raw): %s\n" % message)
|
|
@@ -204,10 +208,17 @@ class WebexWebsocketClient(object):
|
|
|
204
208
|
logger.warning(
|
|
205
209
|
f"An exception occurred while processing message. Ignoring. {messageProcessingException}")
|
|
206
210
|
|
|
207
|
-
@backoff.on_exception(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
+
@backoff.on_exception(
|
|
212
|
+
backoff.expo,
|
|
213
|
+
(
|
|
214
|
+
websockets.ConnectionClosedError,
|
|
215
|
+
websockets.ConnectionClosedOK,
|
|
216
|
+
websockets.ConnectionClosed,
|
|
217
|
+
socket.gaierror,
|
|
218
|
+
InvalidStatusCode,
|
|
219
|
+
),
|
|
220
|
+
max_time=MAX_BACKOFF_TIME
|
|
221
|
+
)
|
|
211
222
|
async def _connect_and_listen():
|
|
212
223
|
ws_url = self.device_info['webSocketUrl']
|
|
213
224
|
logger.info(f"Opening websocket connection to {ws_url}")
|
|
@@ -237,6 +248,16 @@ class WebexWebsocketClient(object):
|
|
|
237
248
|
|
|
238
249
|
try:
|
|
239
250
|
asyncio.get_event_loop().run_until_complete(_connect_and_listen())
|
|
251
|
+
except InvalidStatusCode as e:
|
|
252
|
+
logger.error(f"WebSocket handshake to {ws_url} failed with status {e.status_code}")
|
|
253
|
+
if e.status_code == 404:
|
|
254
|
+
logger.info("Refreshing WDM device info and retrying...")
|
|
255
|
+
self._get_device_info(check_existing=False)
|
|
256
|
+
# update ws_url before retry
|
|
257
|
+
ws_url = self.device_info.get('webSocketUrl')
|
|
258
|
+
asyncio.get_event_loop().run_until_complete(_connect_and_listen())
|
|
259
|
+
else:
|
|
260
|
+
raise
|
|
240
261
|
except Exception as runException:
|
|
241
262
|
logger.error(f"runException: {runException}")
|
|
242
263
|
if self._get_device_info(check_existing=False) is None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: webex_bot
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: Python package for a Webex Bot based on websockets.
|
|
5
5
|
Home-page: https://github.com/fbradyirl/webex_bot
|
|
6
6
|
Author: Finbarr Brady
|
|
@@ -438,6 +438,12 @@ to
|
|
|
438
438
|
bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
|
|
439
439
|
```
|
|
440
440
|
|
|
441
|
+
|
|
442
|
+
### 0.6.1 (2025-May-19)
|
|
443
|
+
|
|
444
|
+
* Handle and retry on InvalidStatusCode in Websocket loop
|
|
445
|
+
|
|
446
|
+
|
|
441
447
|
[1]: https://github.com/aaugustin/websockets
|
|
442
448
|
|
|
443
449
|
[2]: https://github.com/WebexCommunity/WebexPythonSDK
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
webex_bot/__init__.py,sha256=
|
|
1
|
+
webex_bot/__init__.py,sha256=2HF6-vT6Wd0GCEqkCYKsotewyurOtnZ_YySZS14u8C4,95
|
|
2
2
|
webex_bot/exceptions.py,sha256=qs9yVitfJtvxwBMC8uCvTDOxUQ_oZjWFf1dU8Oaue14,740
|
|
3
3
|
webex_bot/formatting.py,sha256=jvPKym-z8CIJygpPVTVbt6vFXQo9_HQHpRDJB-nh-SI,382
|
|
4
4
|
webex_bot/webex_bot.py,sha256=pLNmcAP7J9ZG9QnEDZLYZJa_y1qtO5vudhT0fAi2stA,21282
|
|
@@ -10,9 +10,9 @@ webex_bot/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
10
10
|
webex_bot/models/command.py,sha256=MyThlDaEkGlj1fDE_i_wr79O3QboakimRme8yI744yo,5327
|
|
11
11
|
webex_bot/models/response.py,sha256=d4k2ohR5SUVzvuQzcnm7jQQVTMB0gH9Kz9y09vkoAaU,2545
|
|
12
12
|
webex_bot/websockets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
webex_bot/websockets/webex_websocket_client.py,sha256=
|
|
14
|
-
webex_bot-0.6.
|
|
15
|
-
webex_bot-0.6.
|
|
16
|
-
webex_bot-0.6.
|
|
17
|
-
webex_bot-0.6.
|
|
18
|
-
webex_bot-0.6.
|
|
13
|
+
webex_bot/websockets/webex_websocket_client.py,sha256=srq5PNFvsinUTWNVyQiH4xKQfSLN2jFolMXcU6vxwuo,11265
|
|
14
|
+
webex_bot-0.6.1.dist-info/licenses/LICENSE,sha256=93eGb10xmgkBP2Fh_n0E9YDXe0c0oz-FsnAimXG0S4Y,1072
|
|
15
|
+
webex_bot-0.6.1.dist-info/METADATA,sha256=N9coULEQIURUhGust5oho0qQMHpd9FPp8ys0dgqPh4g,14434
|
|
16
|
+
webex_bot-0.6.1.dist-info/WHEEL,sha256=_z0Kb-VmhLeNt2nZ-PsoQBjD25rP0tBwgAyRYD7oTKI,109
|
|
17
|
+
webex_bot-0.6.1.dist-info/top_level.txt,sha256=q1Y0RtYYinR7oXSwL93cK59c2KN_CbMVca8MLWeF63M,10
|
|
18
|
+
webex_bot-0.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|