webex-bot 0.6.1__tar.gz → 0.6.2__tar.gz

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.
Files changed (35) hide show
  1. {webex_bot-0.6.1/webex_bot.egg-info → webex_bot-0.6.2}/PKG-INFO +6 -1
  2. {webex_bot-0.6.1 → webex_bot-0.6.2}/README.md +5 -0
  3. {webex_bot-0.6.1 → webex_bot-0.6.2}/setup.cfg +1 -1
  4. {webex_bot-0.6.1 → webex_bot-0.6.2}/setup.py +1 -1
  5. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/__init__.py +1 -1
  6. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/webex_bot.py +2 -4
  7. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/websockets/webex_websocket_client.py +22 -4
  8. {webex_bot-0.6.1 → webex_bot-0.6.2/webex_bot.egg-info}/PKG-INFO +6 -1
  9. {webex_bot-0.6.1 → webex_bot-0.6.2}/CONTRIBUTING.rst +0 -0
  10. {webex_bot-0.6.1 → webex_bot-0.6.2}/LICENSE +0 -0
  11. {webex_bot-0.6.1 → webex_bot-0.6.2}/MANIFEST.in +0 -0
  12. {webex_bot-0.6.1 → webex_bot-0.6.2}/docs/Makefile +0 -0
  13. {webex_bot-0.6.1 → webex_bot-0.6.2}/docs/conf.py +0 -0
  14. {webex_bot-0.6.1 → webex_bot-0.6.2}/docs/contributing.rst +0 -0
  15. {webex_bot-0.6.1 → webex_bot-0.6.2}/docs/index.rst +0 -0
  16. {webex_bot-0.6.1 → webex_bot-0.6.2}/docs/installation.rst +0 -0
  17. {webex_bot-0.6.1 → webex_bot-0.6.2}/docs/make.bat +0 -0
  18. {webex_bot-0.6.1 → webex_bot-0.6.2}/docs/usage.rst +0 -0
  19. {webex_bot-0.6.1 → webex_bot-0.6.2}/tests/__init__.py +0 -0
  20. {webex_bot-0.6.1 → webex_bot-0.6.2}/tests/test_webex_bot.py +0 -0
  21. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/cards/__init__.py +0 -0
  22. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/commands/__init__.py +0 -0
  23. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/commands/echo.py +0 -0
  24. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/commands/help.py +0 -0
  25. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/exceptions.py +0 -0
  26. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/formatting.py +0 -0
  27. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/models/__init__.py +0 -0
  28. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/models/command.py +0 -0
  29. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/models/response.py +0 -0
  30. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot/websockets/__init__.py +0 -0
  31. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot.egg-info/SOURCES.txt +0 -0
  32. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot.egg-info/dependency_links.txt +0 -0
  33. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot.egg-info/not-zip-safe +0 -0
  34. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot.egg-info/requires.txt +0 -0
  35. {webex_bot-0.6.1 → webex_bot-0.6.2}/webex_bot.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webex_bot
3
- Version: 0.6.1
3
+ Version: 0.6.2
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
@@ -443,6 +443,9 @@ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
443
443
 
444
444
  * Handle and retry on InvalidStatusCode in Websocket loop
445
445
 
446
+ ### 0.6.2 (2025-May-23)
447
+
448
+ * Fix for [issue #48][i48] - Fix for `Commands not being received` issue.
446
449
 
447
450
  [1]: https://github.com/aaugustin/websockets
448
451
 
@@ -489,3 +492,5 @@ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
489
492
  [i13]: https://github.com/fbradyirl/webex_bot/issues/13
490
493
 
491
494
  [i20]: https://github.com/fbradyirl/webex_bot/issues/20
495
+
496
+ [i48]: https://github.com/fbradyirl/webex_bot/issues/48
@@ -403,6 +403,9 @@ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
403
403
 
404
404
  * Handle and retry on InvalidStatusCode in Websocket loop
405
405
 
406
+ ### 0.6.2 (2025-May-23)
407
+
408
+ * Fix for [issue #48][i48] - Fix for `Commands not being received` issue.
406
409
 
407
410
  [1]: https://github.com/aaugustin/websockets
408
411
 
@@ -449,3 +452,5 @@ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
449
452
  [i13]: https://github.com/fbradyirl/webex_bot/issues/13
450
453
 
451
454
  [i20]: https://github.com/fbradyirl/webex_bot/issues/20
455
+
456
+ [i48]: https://github.com/fbradyirl/webex_bot/issues/48
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.6.1
2
+ current_version = 0.6.2
3
3
  commit = True
4
4
  tag = True
5
5
 
@@ -45,6 +45,6 @@ setup(
45
45
  test_suite='tests',
46
46
  tests_require=test_requirements,
47
47
  url='https://github.com/fbradyirl/webex_bot',
48
- version='0.6.1',
48
+ version='0.6.2',
49
49
  zip_safe=False,
50
50
  )
@@ -1,4 +1,4 @@
1
1
  """Top-level package for Webex Bot."""
2
2
 
3
3
  __author__ = """Finbarr Brady"""
4
- __version__ = '0.6.1'
4
+ __version__ = '0.6.2'
@@ -1,8 +1,8 @@
1
1
  """Main module."""
2
2
  import logging
3
3
  import os
4
-
5
4
  import types
5
+
6
6
  import backoff
7
7
  import coloredlogs
8
8
  import requests
@@ -14,7 +14,7 @@ from webex_bot.exceptions import BotException
14
14
  from webex_bot.formatting import quote_info
15
15
  from webex_bot.models.command import CALLBACK_KEYWORD_KEY, Command, COMMAND_KEYWORD_KEY
16
16
  from webex_bot.models.response import Response
17
- from webex_bot.websockets.webex_websocket_client import WebexWebsocketClient, DEFAULT_DEVICE_URL
17
+ from webex_bot.websockets.webex_websocket_client import WebexWebsocketClient
18
18
 
19
19
  log = logging.getLogger(__name__)
20
20
 
@@ -26,7 +26,6 @@ class WebexBot(WebexWebsocketClient):
26
26
  approved_users=[],
27
27
  approved_domains=[],
28
28
  approved_rooms=[],
29
- device_url=DEFAULT_DEVICE_URL,
30
29
  include_demo_commands=False,
31
30
  bot_name="Webex Bot",
32
31
  bot_help_subtitle="Here are my available commands. Click one to begin.",
@@ -60,7 +59,6 @@ class WebexBot(WebexWebsocketClient):
60
59
  teams_bot_token,
61
60
  on_message=self.process_incoming_message,
62
61
  on_card_action=self.process_incoming_card_action,
63
- device_url=device_url,
64
62
  proxies=proxies)
65
63
 
66
64
  if help_command is None:
@@ -20,7 +20,7 @@ except ImportError:
20
20
 
21
21
  logger = logging.getLogger(__name__)
22
22
 
23
- DEFAULT_DEVICE_URL = "https://wdm-a.wbx2.com/wdm/api/v1"
23
+ DEFAULT_U2C_URL = "https://u2c.wbx2.com/u2c/api/v1/catalog"
24
24
 
25
25
  DEVICE_DATA = {
26
26
  "deviceName": "pywebsocket-client",
@@ -41,14 +41,13 @@ MAX_BACKOFF_TIME = 240
41
41
  class WebexWebsocketClient(object):
42
42
  def __init__(self,
43
43
  access_token,
44
- device_url=DEFAULT_DEVICE_URL,
45
44
  on_message=None,
46
45
  on_card_action=None,
47
46
  proxies=None):
48
47
  self.access_token = access_token
49
48
  self.teams = WebexAPI(access_token=access_token, proxies=proxies)
50
- self.device_url = device_url
51
49
  self.device_info = None
50
+ self.device_url = self._get_device_url()
52
51
  self.on_message = on_message
53
52
  self.on_card_action = on_card_action
54
53
  self.proxies = proxies
@@ -155,6 +154,25 @@ class WebexWebsocketClient(object):
155
154
  asyncio.run(self.websocket.send(json.dumps(ack_message)))
156
155
  logger.info(f"WebSocket ack message with id={message_id}. Complete.")
157
156
 
157
+ def _get_device_url(self):
158
+ headers = {}
159
+ headers["Authorization"] = 'Bearer ' + self.access_token
160
+
161
+ params = {"format": "hostmap"}
162
+ response = requests.get(DEFAULT_U2C_URL, headers=headers, params=params)
163
+
164
+ # check for 401 Unauthorized
165
+ if response.status_code == 401:
166
+ logger.error("Unauthorized access. Please check your access token.")
167
+ raise Exception("Unauthorized access. Please check your access token.")
168
+
169
+ data = response.json()
170
+
171
+ wdm_url = data["serviceLinks"].get("wdm") # or whatever key your hostmap uses
172
+ logging.info(f"wdm url: {wdm_url}")
173
+ return wdm_url
174
+
175
+
158
176
  def _get_device_info(self, check_existing=True):
159
177
  """
160
178
  Get device info from Webex Cloud.
@@ -264,4 +282,4 @@ class WebexWebsocketClient(object):
264
282
  logger.error('could not create device info')
265
283
  raise Exception("No WDM device info")
266
284
  # trigger re-connect
267
- asyncio.get_event_loop().run_until_complete(_connect_and_listen())
285
+ asyncio.get_event_loop().run_until_complete(_connect_and_listen())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webex_bot
3
- Version: 0.6.1
3
+ Version: 0.6.2
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
@@ -443,6 +443,9 @@ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
443
443
 
444
444
  * Handle and retry on InvalidStatusCode in Websocket loop
445
445
 
446
+ ### 0.6.2 (2025-May-23)
447
+
448
+ * Fix for [issue #48][i48] - Fix for `Commands not being received` issue.
446
449
 
447
450
  [1]: https://github.com/aaugustin/websockets
448
451
 
@@ -489,3 +492,5 @@ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
489
492
  [i13]: https://github.com/fbradyirl/webex_bot/issues/13
490
493
 
491
494
  [i20]: https://github.com/fbradyirl/webex_bot/issues/20
495
+
496
+ [i48]: https://github.com/fbradyirl/webex_bot/issues/48
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes