webex-bot 0.5.2__tar.gz → 0.6.1__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.5.2 → webex_bot-0.6.1}/CONTRIBUTING.rst +1 -1
  2. {webex_bot-0.5.2 → webex_bot-0.6.1}/PKG-INFO +78 -17
  3. webex_bot-0.5.2/webex_bot.egg-info/PKG-INFO → webex_bot-0.6.1/README.md +52 -31
  4. {webex_bot-0.5.2 → webex_bot-0.6.1}/setup.cfg +1 -1
  5. {webex_bot-0.5.2 → webex_bot-0.6.1}/setup.py +7 -5
  6. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/__init__.py +1 -1
  7. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/commands/echo.py +2 -2
  8. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/commands/help.py +2 -2
  9. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/models/command.py +2 -2
  10. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/models/response.py +1 -1
  11. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/webex_bot.py +5 -4
  12. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/websockets/webex_websocket_client.py +27 -6
  13. webex_bot-0.5.2/README.md → webex_bot-0.6.1/webex_bot.egg-info/PKG-INFO +92 -8
  14. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot.egg-info/requires.txt +1 -1
  15. {webex_bot-0.5.2 → webex_bot-0.6.1}/LICENSE +0 -0
  16. {webex_bot-0.5.2 → webex_bot-0.6.1}/MANIFEST.in +0 -0
  17. {webex_bot-0.5.2 → webex_bot-0.6.1}/docs/Makefile +0 -0
  18. {webex_bot-0.5.2 → webex_bot-0.6.1}/docs/conf.py +0 -0
  19. {webex_bot-0.5.2 → webex_bot-0.6.1}/docs/contributing.rst +0 -0
  20. {webex_bot-0.5.2 → webex_bot-0.6.1}/docs/index.rst +0 -0
  21. {webex_bot-0.5.2 → webex_bot-0.6.1}/docs/installation.rst +0 -0
  22. {webex_bot-0.5.2 → webex_bot-0.6.1}/docs/make.bat +0 -0
  23. {webex_bot-0.5.2 → webex_bot-0.6.1}/docs/usage.rst +0 -0
  24. {webex_bot-0.5.2 → webex_bot-0.6.1}/tests/__init__.py +0 -0
  25. {webex_bot-0.5.2 → webex_bot-0.6.1}/tests/test_webex_bot.py +0 -0
  26. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/cards/__init__.py +0 -0
  27. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/commands/__init__.py +0 -0
  28. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/exceptions.py +0 -0
  29. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/formatting.py +0 -0
  30. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/models/__init__.py +0 -0
  31. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot/websockets/__init__.py +0 -0
  32. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot.egg-info/SOURCES.txt +0 -0
  33. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot.egg-info/dependency_links.txt +0 -0
  34. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot.egg-info/not-zip-safe +0 -0
  35. {webex_bot-0.5.2 → webex_bot-0.6.1}/webex_bot.egg-info/top_level.txt +0 -0
@@ -102,7 +102,7 @@ Before you submit a pull request, check that it meets these guidelines:
102
102
  2. If the pull request adds functionality, the docs should be updated. Put
103
103
  your new functionality into a function with a docstring, and add the
104
104
  feature to the list in README.rst.
105
- 3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check
105
+ 3. The pull request should work for Python 3.10, 3.11, 3.12, and 3.13, and for PyPy. Check
106
106
  https://travis-ci.com/fbradyirl/webex_bot/pull_requests
107
107
  and make sure that the tests pass for all supported Python versions.
108
108
 
@@ -1,23 +1,42 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: webex_bot
3
- Version: 0.5.2
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
7
7
  Author-email: finbarr@somemail.com
8
8
  License: MIT license
9
9
  Keywords: webex_bot
10
- Platform: UNKNOWN
11
10
  Classifier: Development Status :: 2 - Pre-Alpha
12
11
  Classifier: Intended Audience :: Developers
13
12
  Classifier: License :: OSI Approved :: MIT License
14
13
  Classifier: Natural Language :: English
15
- Classifier: Programming Language :: Python :: 3.8
16
- Classifier: Programming Language :: Python :: 3.9
17
- Requires-Python: >=3.8
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
18
19
  Description-Content-Type: text/markdown
19
- Provides-Extra: proxy
20
20
  License-File: LICENSE
21
+ Requires-Dist: webexpythonsdk==2.0.4
22
+ Requires-Dist: coloredlogs
23
+ Requires-Dist: websockets==11.0.3
24
+ Requires-Dist: backoff
25
+ Provides-Extra: proxy
26
+ Requires-Dist: websockets_proxy>=0.1.1; extra == "proxy"
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: keywords
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: provides-extra
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
21
40
 
22
41
  # Introduction
23
42
 
@@ -44,7 +63,7 @@ inside a LAN. This package instead uses a websocket to receive messages from the
44
63
  * Allows for single or multi-post responses. This is useful if you want to reply with a lot of data, but it won't all
45
64
  fit in a single response.
46
65
  * Restrict bot to certain users or domains.
47
- * Uses the [webexteamssdk][2] package to send back replies from the bot.
66
+ * Uses the [webexpythonsdk][2] package to send back replies from the bot.
48
67
 
49
68
  ## 🚀 Getting started
50
69
 
@@ -56,7 +75,7 @@ You can find a sample project, using OpenAI/ChatGPT with this library here: http
56
75
 
57
76
  ----
58
77
 
59
- **Only Python 3.9 is tested at this time.**
78
+ **Only Python 3.13 is tested at this time.**
60
79
 
61
80
  1. Install this module from pypi:
62
81
 
@@ -69,7 +88,7 @@ If you need optional proxy support, use this command instead:
69
88
  2. On the Webex Developer portal, create a new [bot token][3] and expose it as an environment variable.
70
89
 
71
90
  ```sh
72
- export WEBEX_TEAMS_ACCESS_TOKEN=<your bots token>
91
+ export WEBEX_ACCESS_TOKEN=<your bots token>
73
92
  ```
74
93
 
75
94
  3. Run your script:
@@ -92,7 +111,7 @@ proxies = {
92
111
  }
93
112
 
94
113
  # Create a Bot Object
95
- bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN"),
114
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN"),
96
115
  approved_rooms=['06586d8d-6aad-4201-9a69-0bf9eeb5766e'],
97
116
  bot_name="My Teams Ops Bot",
98
117
  include_demo_commands=True,
@@ -110,9 +129,9 @@ where EchoCommand is defined as:
110
129
  ```python
111
130
  import logging
112
131
 
113
- from webexteamssdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
132
+ from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
114
133
  Text, Image, HorizontalAlignment
115
- from webexteamssdk.models.cards.actions import Submit
134
+ from webexpythonsdk.models.cards.actions import Submit
116
135
 
117
136
  from webex_bot.formatting import quote_info
118
137
  from webex_bot.models.command import Command
@@ -204,7 +223,8 @@ and off you go!
204
223
 
205
224
  # Help
206
225
 
207
- * If you are a Cisco employee, you can join the [discussion space here][7].
226
+ * If you are a Cisco employee, and find this useful, consider sending me a [Connected Recognition][8] (cec: `fibrady`) 🙂
227
+ * Also, join the [discussion space here][7].
208
228
  * Alternatively, open an issue or PR with a question on usage.
209
229
 
210
230
  # History
@@ -389,9 +409,44 @@ and off you go!
389
409
 
390
410
  * Introduce exact_command_keyword_match feature ([#59][pr59])
391
411
 
412
+ ### 0.6.0 (2025-Apr-24)
413
+
414
+ * Migrate from "webexteamssdk" library to "webexpythonsdk" library ([#62][pr62])
415
+ * Updated webexpythonsdk library version ([#69][pr69])
416
+ * Added support for generators ([#71][pr71])
417
+
418
+ #### Breaking changes for the existing webex_bot based applications:
419
+
420
+ * Support is limited to only Python 3.10+ versions. webex_bot applications running on lower Python versions will have to
421
+ adapt to this change in Python version requirement.
422
+ * Make the following code changes to your webex_bot application to adapt to ```webex_bot 0.6.0 version and upwards```.
423
+
424
+ 1. ***Mandatory step:*** Replace all imports from `webexteamssdk` to `webexpythonsdk`. For example:
425
+ ```
426
+ from webexteamssdk.models.cards import TextBlock
427
+ ```
428
+ to
429
+ ```
430
+ from webexpythonsdk.models.cards import TextBlock\
431
+ ```
432
+ 2. ***This step is applicable only if you pass your Webex bot access token to webex_bot via environment variable:*** Change your Webex bot access token environment variable from `WEBEX_TEAMS_ACCESS_TOKEN` to `WEBEX_ACCESS_TOKEN`. Also, make the following code change in your webex_bot application:
433
+ ```
434
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN")
435
+ ```
436
+ to
437
+ ```
438
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
439
+ ```
440
+
441
+
442
+ ### 0.6.1 (2025-May-19)
443
+
444
+ * Handle and retry on InvalidStatusCode in Websocket loop
445
+
446
+
392
447
  [1]: https://github.com/aaugustin/websockets
393
448
 
394
- [2]: https://github.com/CiscoDevNet/webexteamssdk
449
+ [2]: https://github.com/WebexCommunity/WebexPythonSDK
395
450
 
396
451
  [3]: https://developer.webex.com/docs/bots
397
452
 
@@ -403,6 +458,8 @@ and off you go!
403
458
 
404
459
  [7]: https://eurl.io/#TeBLqZjLs
405
460
 
461
+ [8]: https://www.globoforce.net/microsites/t/awards/Redeem?client=cisco&setCAG=true
462
+
406
463
  [pr43]: https://github.com/fbradyirl/webex_bot/pull/43
407
464
 
408
465
  [pr46]: https://github.com/fbradyirl/webex_bot/pull/46
@@ -417,6 +474,12 @@ and off you go!
417
474
 
418
475
  [pr59]: https://github.com/fbradyirl/webex_bot/pull/59
419
476
 
477
+ [pr62]: https://github.com/fbradyirl/webex_bot/pull/62
478
+
479
+ [pr69]: https://github.com/fbradyirl/webex_bot/pull/69
480
+
481
+ [pr71]: https://github.com/fbradyirl/webex_bot/pull/71
482
+
420
483
  [i1]: https://github.com/fbradyirl/webex_bot/issues/1
421
484
 
422
485
  [i2]: https://github.com/fbradyirl/webex_bot/issues/2
@@ -426,5 +489,3 @@ and off you go!
426
489
  [i13]: https://github.com/fbradyirl/webex_bot/issues/13
427
490
 
428
491
  [i20]: https://github.com/fbradyirl/webex_bot/issues/20
429
-
430
-
@@ -1,24 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: webex-bot
3
- Version: 0.5.2
4
- Summary: Python package for a Webex Bot based on websockets.
5
- Home-page: https://github.com/fbradyirl/webex_bot
6
- Author: Finbarr Brady
7
- Author-email: finbarr@somemail.com
8
- License: MIT license
9
- Keywords: webex_bot
10
- Platform: UNKNOWN
11
- Classifier: Development Status :: 2 - Pre-Alpha
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Natural Language :: English
15
- Classifier: Programming Language :: Python :: 3.8
16
- Classifier: Programming Language :: Python :: 3.9
17
- Requires-Python: >=3.8
18
- Description-Content-Type: text/markdown
19
- Provides-Extra: proxy
20
- License-File: LICENSE
21
-
22
1
  # Introduction
23
2
 
24
3
  [![Pypi](https://img.shields.io/pypi/v/webex_bot.svg)](https://pypi.python.org/pypi/webex_bot) [![Build Status](https://github.com/fbradyirl/webex_bot/workflows/Python%20package/badge.svg)](https://github.com/fbradyirl/webex_bot/actions)
@@ -44,7 +23,7 @@ inside a LAN. This package instead uses a websocket to receive messages from the
44
23
  * Allows for single or multi-post responses. This is useful if you want to reply with a lot of data, but it won't all
45
24
  fit in a single response.
46
25
  * Restrict bot to certain users or domains.
47
- * Uses the [webexteamssdk][2] package to send back replies from the bot.
26
+ * Uses the [webexpythonsdk][2] package to send back replies from the bot.
48
27
 
49
28
  ## 🚀 Getting started
50
29
 
@@ -56,7 +35,7 @@ You can find a sample project, using OpenAI/ChatGPT with this library here: http
56
35
 
57
36
  ----
58
37
 
59
- **Only Python 3.9 is tested at this time.**
38
+ **Only Python 3.13 is tested at this time.**
60
39
 
61
40
  1. Install this module from pypi:
62
41
 
@@ -69,7 +48,7 @@ If you need optional proxy support, use this command instead:
69
48
  2. On the Webex Developer portal, create a new [bot token][3] and expose it as an environment variable.
70
49
 
71
50
  ```sh
72
- export WEBEX_TEAMS_ACCESS_TOKEN=<your bots token>
51
+ export WEBEX_ACCESS_TOKEN=<your bots token>
73
52
  ```
74
53
 
75
54
  3. Run your script:
@@ -92,7 +71,7 @@ proxies = {
92
71
  }
93
72
 
94
73
  # Create a Bot Object
95
- bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN"),
74
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN"),
96
75
  approved_rooms=['06586d8d-6aad-4201-9a69-0bf9eeb5766e'],
97
76
  bot_name="My Teams Ops Bot",
98
77
  include_demo_commands=True,
@@ -110,9 +89,9 @@ where EchoCommand is defined as:
110
89
  ```python
111
90
  import logging
112
91
 
113
- from webexteamssdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
92
+ from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
114
93
  Text, Image, HorizontalAlignment
115
- from webexteamssdk.models.cards.actions import Submit
94
+ from webexpythonsdk.models.cards.actions import Submit
116
95
 
117
96
  from webex_bot.formatting import quote_info
118
97
  from webex_bot.models.command import Command
@@ -204,7 +183,8 @@ and off you go!
204
183
 
205
184
  # Help
206
185
 
207
- * If you are a Cisco employee, you can join the [discussion space here][7].
186
+ * If you are a Cisco employee, and find this useful, consider sending me a [Connected Recognition][8] (cec: `fibrady`) 🙂
187
+ * Also, join the [discussion space here][7].
208
188
  * Alternatively, open an issue or PR with a question on usage.
209
189
 
210
190
  # History
@@ -389,9 +369,44 @@ and off you go!
389
369
 
390
370
  * Introduce exact_command_keyword_match feature ([#59][pr59])
391
371
 
372
+ ### 0.6.0 (2025-Apr-24)
373
+
374
+ * Migrate from "webexteamssdk" library to "webexpythonsdk" library ([#62][pr62])
375
+ * Updated webexpythonsdk library version ([#69][pr69])
376
+ * Added support for generators ([#71][pr71])
377
+
378
+ #### Breaking changes for the existing webex_bot based applications:
379
+
380
+ * Support is limited to only Python 3.10+ versions. webex_bot applications running on lower Python versions will have to
381
+ adapt to this change in Python version requirement.
382
+ * Make the following code changes to your webex_bot application to adapt to ```webex_bot 0.6.0 version and upwards```.
383
+
384
+ 1. ***Mandatory step:*** Replace all imports from `webexteamssdk` to `webexpythonsdk`. For example:
385
+ ```
386
+ from webexteamssdk.models.cards import TextBlock
387
+ ```
388
+ to
389
+ ```
390
+ from webexpythonsdk.models.cards import TextBlock\
391
+ ```
392
+ 2. ***This step is applicable only if you pass your Webex bot access token to webex_bot via environment variable:*** Change your Webex bot access token environment variable from `WEBEX_TEAMS_ACCESS_TOKEN` to `WEBEX_ACCESS_TOKEN`. Also, make the following code change in your webex_bot application:
393
+ ```
394
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN")
395
+ ```
396
+ to
397
+ ```
398
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
399
+ ```
400
+
401
+
402
+ ### 0.6.1 (2025-May-19)
403
+
404
+ * Handle and retry on InvalidStatusCode in Websocket loop
405
+
406
+
392
407
  [1]: https://github.com/aaugustin/websockets
393
408
 
394
- [2]: https://github.com/CiscoDevNet/webexteamssdk
409
+ [2]: https://github.com/WebexCommunity/WebexPythonSDK
395
410
 
396
411
  [3]: https://developer.webex.com/docs/bots
397
412
 
@@ -403,6 +418,8 @@ and off you go!
403
418
 
404
419
  [7]: https://eurl.io/#TeBLqZjLs
405
420
 
421
+ [8]: https://www.globoforce.net/microsites/t/awards/Redeem?client=cisco&setCAG=true
422
+
406
423
  [pr43]: https://github.com/fbradyirl/webex_bot/pull/43
407
424
 
408
425
  [pr46]: https://github.com/fbradyirl/webex_bot/pull/46
@@ -417,6 +434,12 @@ and off you go!
417
434
 
418
435
  [pr59]: https://github.com/fbradyirl/webex_bot/pull/59
419
436
 
437
+ [pr62]: https://github.com/fbradyirl/webex_bot/pull/62
438
+
439
+ [pr69]: https://github.com/fbradyirl/webex_bot/pull/69
440
+
441
+ [pr71]: https://github.com/fbradyirl/webex_bot/pull/71
442
+
420
443
  [i1]: https://github.com/fbradyirl/webex_bot/issues/1
421
444
 
422
445
  [i2]: https://github.com/fbradyirl/webex_bot/issues/2
@@ -426,5 +449,3 @@ and off you go!
426
449
  [i13]: https://github.com/fbradyirl/webex_bot/issues/13
427
450
 
428
451
  [i20]: https://github.com/fbradyirl/webex_bot/issues/20
429
-
430
-
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.5.2
2
+ current_version = 0.6.1
3
3
  commit = True
4
4
  tag = True
5
5
 
@@ -7,7 +7,7 @@ from setuptools import setup, find_packages
7
7
  with open('README.md') as readme_file:
8
8
  readme = readme_file.read()
9
9
 
10
- requirements = ['webexteamssdk==1.6.1', 'coloredlogs', 'websockets==11.0.3', 'backoff']
10
+ requirements = ['webexpythonsdk==2.0.4', 'coloredlogs', 'websockets==11.0.3', 'backoff']
11
11
 
12
12
  setup_requirements = ['pytest-runner', ]
13
13
 
@@ -20,14 +20,16 @@ extras_requirements = {
20
20
  setup(
21
21
  author="Finbarr Brady",
22
22
  author_email='finbarr@somemail.com',
23
- python_requires='>=3.8',
23
+ python_requires='>=3.10',
24
24
  classifiers=[
25
25
  'Development Status :: 2 - Pre-Alpha',
26
26
  'Intended Audience :: Developers',
27
27
  'License :: OSI Approved :: MIT License',
28
28
  'Natural Language :: English',
29
- 'Programming Language :: Python :: 3.8',
30
- 'Programming Language :: Python :: 3.9',
29
+ 'Programming Language :: Python :: 3.10',
30
+ 'Programming Language :: Python :: 3.11',
31
+ 'Programming Language :: Python :: 3.12',
32
+ 'Programming Language :: Python :: 3.13',
31
33
  ],
32
34
  description="Python package for a Webex Bot based on websockets.",
33
35
  extras_require=extras_requirements,
@@ -43,6 +45,6 @@ setup(
43
45
  test_suite='tests',
44
46
  tests_require=test_requirements,
45
47
  url='https://github.com/fbradyirl/webex_bot',
46
- version='0.5.2',
48
+ version='0.6.1',
47
49
  zip_safe=False,
48
50
  )
@@ -1,4 +1,4 @@
1
1
  """Top-level package for Webex Bot."""
2
2
 
3
3
  __author__ = """Finbarr Brady"""
4
- __version__ = '0.5.2'
4
+ __version__ = '0.6.1'
@@ -1,8 +1,8 @@
1
1
  import logging
2
2
 
3
- from webexteamssdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
3
+ from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
4
4
  Text, Image, HorizontalAlignment
5
- from webexteamssdk.models.cards.actions import Submit
5
+ from webexpythonsdk.models.cards.actions import Submit
6
6
 
7
7
  from webex_bot.formatting import quote_info
8
8
  from webex_bot.models.command import Command
@@ -1,8 +1,8 @@
1
1
  import logging
2
2
 
3
- from webexteamssdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
3
+ from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
4
4
  ImageSize, Image, Fact
5
- from webexteamssdk.models.cards.actions import Submit
5
+ from webexpythonsdk.models.cards.actions import Submit
6
6
 
7
7
  from webex_bot.models.command import Command, COMMAND_KEYWORD_KEY
8
8
  from webex_bot.models.response import response_from_adaptive_card
@@ -30,7 +30,7 @@ class Command(ABC):
30
30
  @param chained_commands: (optional) List of other commands related
31
31
  to this command. This allows multiple related cards to be added at once.
32
32
  @param card: (deprecated) A dict representation of the JSON card.
33
- Prefer to use cards built in code using the webexteamssdk.models.cards classes
33
+ Prefer to use cards built in code using the webexpythonsdk.models.cards classes
34
34
  (see https://github.com/fbradyirl/webex_bot/blob/main/webex_bot/commands/echo.py for example)
35
35
  @param help_message: Short description of this command.
36
36
  @param delete_previous_message: If True, the card which invoked this command will be deleted. (default False)
@@ -55,7 +55,7 @@ class Command(ABC):
55
55
  if card is not None:
56
56
  log.warning(f"[{command_keyword}]. Using a card dict is now deprecated. "
57
57
  f"Switch to use adaptive cards built in code "
58
- "using the webexteamssdk.models.cards classes (see "
58
+ "using the webexpythonsdk.models.cards classes (see "
59
59
  "https://github.com/fbradyirl/webex_bot/blob/main/webex_bot/commands/echo.py for example)")
60
60
  if 'actions' in card:
61
61
  if len(card['actions']) > 0:
@@ -1,6 +1,6 @@
1
1
  import json
2
2
 
3
- from webexteamssdk.models.cards import AdaptiveCard
3
+ from webexpythonsdk.models.cards import AdaptiveCard
4
4
 
5
5
 
6
6
  def response_from_adaptive_card(adaptive_card: AdaptiveCard):
@@ -2,10 +2,11 @@
2
2
  import logging
3
3
  import os
4
4
 
5
+ import types
5
6
  import backoff
6
7
  import coloredlogs
7
8
  import requests
8
- import webexteamssdk
9
+ import webexpythonsdk
9
10
 
10
11
  from webex_bot.commands.echo import EchoCommand
11
12
  from webex_bot.commands.help import HelpCommand
@@ -95,7 +96,7 @@ class WebexBot(WebexWebsocketClient):
95
96
  @backoff.on_exception(backoff.expo, requests.exceptions.ConnectionError)
96
97
  def get_me_info(self):
97
98
  """
98
- Fetch me info from webexteamssdk
99
+ Fetch me info from webexpythonsdk
99
100
  """
100
101
  me = self.teams.people.me()
101
102
  self.bot_display_name = me.displayName
@@ -168,7 +169,7 @@ class WebexBot(WebexWebsocketClient):
168
169
  for member in room_members:
169
170
  if member.personEmail == user_email:
170
171
  is_user_member = True
171
- except webexteamssdk.exceptions.ApiError as apie:
172
+ except webexpythonsdk.exceptions.ApiError as apie:
172
173
  log.warn(f"API error: {apie}")
173
174
  return is_user_member
174
175
 
@@ -336,7 +337,7 @@ class WebexBot(WebexWebsocketClient):
336
337
  self.teams.messages.create(**reply)
337
338
  reply = "ok"
338
339
  # Support returning a list of Responses
339
- elif reply and isinstance(reply, list):
340
+ elif reply and (isinstance(reply, list) or isinstance(reply, types.GeneratorType)):
340
341
  for response in reply:
341
342
  # Make sure is a Response
342
343
  if isinstance(response, Response):
@@ -9,7 +9,8 @@ import backoff
9
9
  import certifi
10
10
  import requests
11
11
  import websockets
12
- from webexteamssdk import WebexTeamsAPI
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
@@ -45,7 +46,7 @@ class WebexWebsocketClient(object):
45
46
  on_card_action=None,
46
47
  proxies=None):
47
48
  self.access_token = access_token
48
- self.teams = WebexTeamsAPI(access_token=access_token, proxies=proxies)
49
+ self.teams = WebexAPI(access_token=access_token, proxies=proxies)
49
50
  self.device_url = device_url
50
51
  self.device_info = None
51
52
  self.on_message = on_message
@@ -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(backoff.expo, websockets.ConnectionClosedError, max_time=MAX_BACKOFF_TIME)
208
- @backoff.on_exception(backoff.expo, websockets.ConnectionClosedOK, max_time=MAX_BACKOFF_TIME)
209
- @backoff.on_exception(backoff.expo, websockets.ConnectionClosed, max_time=MAX_BACKOFF_TIME)
210
- @backoff.on_exception(backoff.expo, socket.gaierror, max_time=MAX_BACKOFF_TIME)
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,3 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: webex_bot
3
+ Version: 0.6.1
4
+ Summary: Python package for a Webex Bot based on websockets.
5
+ Home-page: https://github.com/fbradyirl/webex_bot
6
+ Author: Finbarr Brady
7
+ Author-email: finbarr@somemail.com
8
+ License: MIT license
9
+ Keywords: webex_bot
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: webexpythonsdk==2.0.4
22
+ Requires-Dist: coloredlogs
23
+ Requires-Dist: websockets==11.0.3
24
+ Requires-Dist: backoff
25
+ Provides-Extra: proxy
26
+ Requires-Dist: websockets_proxy>=0.1.1; extra == "proxy"
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: keywords
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: provides-extra
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
40
+
1
41
  # Introduction
2
42
 
3
43
  [![Pypi](https://img.shields.io/pypi/v/webex_bot.svg)](https://pypi.python.org/pypi/webex_bot) [![Build Status](https://github.com/fbradyirl/webex_bot/workflows/Python%20package/badge.svg)](https://github.com/fbradyirl/webex_bot/actions)
@@ -23,7 +63,7 @@ inside a LAN. This package instead uses a websocket to receive messages from the
23
63
  * Allows for single or multi-post responses. This is useful if you want to reply with a lot of data, but it won't all
24
64
  fit in a single response.
25
65
  * Restrict bot to certain users or domains.
26
- * Uses the [webexteamssdk][2] package to send back replies from the bot.
66
+ * Uses the [webexpythonsdk][2] package to send back replies from the bot.
27
67
 
28
68
  ## 🚀 Getting started
29
69
 
@@ -35,7 +75,7 @@ You can find a sample project, using OpenAI/ChatGPT with this library here: http
35
75
 
36
76
  ----
37
77
 
38
- **Only Python 3.9 is tested at this time.**
78
+ **Only Python 3.13 is tested at this time.**
39
79
 
40
80
  1. Install this module from pypi:
41
81
 
@@ -48,7 +88,7 @@ If you need optional proxy support, use this command instead:
48
88
  2. On the Webex Developer portal, create a new [bot token][3] and expose it as an environment variable.
49
89
 
50
90
  ```sh
51
- export WEBEX_TEAMS_ACCESS_TOKEN=<your bots token>
91
+ export WEBEX_ACCESS_TOKEN=<your bots token>
52
92
  ```
53
93
 
54
94
  3. Run your script:
@@ -71,7 +111,7 @@ proxies = {
71
111
  }
72
112
 
73
113
  # Create a Bot Object
74
- bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN"),
114
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN"),
75
115
  approved_rooms=['06586d8d-6aad-4201-9a69-0bf9eeb5766e'],
76
116
  bot_name="My Teams Ops Bot",
77
117
  include_demo_commands=True,
@@ -89,9 +129,9 @@ where EchoCommand is defined as:
89
129
  ```python
90
130
  import logging
91
131
 
92
- from webexteamssdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
132
+ from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
93
133
  Text, Image, HorizontalAlignment
94
- from webexteamssdk.models.cards.actions import Submit
134
+ from webexpythonsdk.models.cards.actions import Submit
95
135
 
96
136
  from webex_bot.formatting import quote_info
97
137
  from webex_bot.models.command import Command
@@ -183,7 +223,8 @@ and off you go!
183
223
 
184
224
  # Help
185
225
 
186
- * If you are a Cisco employee, you can join the [discussion space here][7].
226
+ * If you are a Cisco employee, and find this useful, consider sending me a [Connected Recognition][8] (cec: `fibrady`) 🙂
227
+ * Also, join the [discussion space here][7].
187
228
  * Alternatively, open an issue or PR with a question on usage.
188
229
 
189
230
  # History
@@ -368,9 +409,44 @@ and off you go!
368
409
 
369
410
  * Introduce exact_command_keyword_match feature ([#59][pr59])
370
411
 
412
+ ### 0.6.0 (2025-Apr-24)
413
+
414
+ * Migrate from "webexteamssdk" library to "webexpythonsdk" library ([#62][pr62])
415
+ * Updated webexpythonsdk library version ([#69][pr69])
416
+ * Added support for generators ([#71][pr71])
417
+
418
+ #### Breaking changes for the existing webex_bot based applications:
419
+
420
+ * Support is limited to only Python 3.10+ versions. webex_bot applications running on lower Python versions will have to
421
+ adapt to this change in Python version requirement.
422
+ * Make the following code changes to your webex_bot application to adapt to ```webex_bot 0.6.0 version and upwards```.
423
+
424
+ 1. ***Mandatory step:*** Replace all imports from `webexteamssdk` to `webexpythonsdk`. For example:
425
+ ```
426
+ from webexteamssdk.models.cards import TextBlock
427
+ ```
428
+ to
429
+ ```
430
+ from webexpythonsdk.models.cards import TextBlock\
431
+ ```
432
+ 2. ***This step is applicable only if you pass your Webex bot access token to webex_bot via environment variable:*** Change your Webex bot access token environment variable from `WEBEX_TEAMS_ACCESS_TOKEN` to `WEBEX_ACCESS_TOKEN`. Also, make the following code change in your webex_bot application:
433
+ ```
434
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN")
435
+ ```
436
+ to
437
+ ```
438
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN")
439
+ ```
440
+
441
+
442
+ ### 0.6.1 (2025-May-19)
443
+
444
+ * Handle and retry on InvalidStatusCode in Websocket loop
445
+
446
+
371
447
  [1]: https://github.com/aaugustin/websockets
372
448
 
373
- [2]: https://github.com/CiscoDevNet/webexteamssdk
449
+ [2]: https://github.com/WebexCommunity/WebexPythonSDK
374
450
 
375
451
  [3]: https://developer.webex.com/docs/bots
376
452
 
@@ -382,6 +458,8 @@ and off you go!
382
458
 
383
459
  [7]: https://eurl.io/#TeBLqZjLs
384
460
 
461
+ [8]: https://www.globoforce.net/microsites/t/awards/Redeem?client=cisco&setCAG=true
462
+
385
463
  [pr43]: https://github.com/fbradyirl/webex_bot/pull/43
386
464
 
387
465
  [pr46]: https://github.com/fbradyirl/webex_bot/pull/46
@@ -396,6 +474,12 @@ and off you go!
396
474
 
397
475
  [pr59]: https://github.com/fbradyirl/webex_bot/pull/59
398
476
 
477
+ [pr62]: https://github.com/fbradyirl/webex_bot/pull/62
478
+
479
+ [pr69]: https://github.com/fbradyirl/webex_bot/pull/69
480
+
481
+ [pr71]: https://github.com/fbradyirl/webex_bot/pull/71
482
+
399
483
  [i1]: https://github.com/fbradyirl/webex_bot/issues/1
400
484
 
401
485
  [i2]: https://github.com/fbradyirl/webex_bot/issues/2
@@ -1,4 +1,4 @@
1
- webexteamssdk==1.6.1
1
+ webexpythonsdk==2.0.4
2
2
  coloredlogs
3
3
  websockets==11.0.3
4
4
  backoff
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes