webex-bot 0.5.2__tar.gz → 0.6.0__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.
- {webex_bot-0.5.2 → webex_bot-0.6.0}/CONTRIBUTING.rst +1 -1
- {webex_bot-0.5.2 → webex_bot-0.6.0}/PKG-INFO +72 -17
- webex_bot-0.5.2/webex_bot.egg-info/PKG-INFO → webex_bot-0.6.0/README.md +46 -31
- {webex_bot-0.5.2 → webex_bot-0.6.0}/setup.cfg +1 -1
- {webex_bot-0.5.2 → webex_bot-0.6.0}/setup.py +7 -5
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/__init__.py +1 -1
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/commands/echo.py +2 -2
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/commands/help.py +2 -2
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/models/command.py +2 -2
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/models/response.py +1 -1
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/webex_bot.py +5 -4
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/websockets/webex_websocket_client.py +2 -2
- webex_bot-0.5.2/README.md → webex_bot-0.6.0/webex_bot.egg-info/PKG-INFO +86 -8
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot.egg-info/requires.txt +1 -1
- {webex_bot-0.5.2 → webex_bot-0.6.0}/LICENSE +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/MANIFEST.in +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/docs/Makefile +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/docs/conf.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/docs/contributing.rst +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/docs/index.rst +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/docs/installation.rst +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/docs/make.bat +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/docs/usage.rst +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/tests/__init__.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/tests/test_webex_bot.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/cards/__init__.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/commands/__init__.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/exceptions.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/formatting.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/models/__init__.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot/websockets/__init__.py +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot.egg-info/SOURCES.txt +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot.egg-info/dependency_links.txt +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/webex_bot.egg-info/not-zip-safe +0 -0
- {webex_bot-0.5.2 → webex_bot-0.6.0}/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.
|
|
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
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: webex_bot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
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.
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.
|
|
17
|
-
|
|
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 [
|
|
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.
|
|
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
|
|
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("
|
|
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
|
|
132
|
+
from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
|
|
114
133
|
Text, Image, HorizontalAlignment
|
|
115
|
-
from
|
|
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,
|
|
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,38 @@ 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
|
+
|
|
392
441
|
[1]: https://github.com/aaugustin/websockets
|
|
393
442
|
|
|
394
|
-
[2]: https://github.com/
|
|
443
|
+
[2]: https://github.com/WebexCommunity/WebexPythonSDK
|
|
395
444
|
|
|
396
445
|
[3]: https://developer.webex.com/docs/bots
|
|
397
446
|
|
|
@@ -403,6 +452,8 @@ and off you go!
|
|
|
403
452
|
|
|
404
453
|
[7]: https://eurl.io/#TeBLqZjLs
|
|
405
454
|
|
|
455
|
+
[8]: https://www.globoforce.net/microsites/t/awards/Redeem?client=cisco&setCAG=true
|
|
456
|
+
|
|
406
457
|
[pr43]: https://github.com/fbradyirl/webex_bot/pull/43
|
|
407
458
|
|
|
408
459
|
[pr46]: https://github.com/fbradyirl/webex_bot/pull/46
|
|
@@ -417,6 +468,12 @@ and off you go!
|
|
|
417
468
|
|
|
418
469
|
[pr59]: https://github.com/fbradyirl/webex_bot/pull/59
|
|
419
470
|
|
|
471
|
+
[pr62]: https://github.com/fbradyirl/webex_bot/pull/62
|
|
472
|
+
|
|
473
|
+
[pr69]: https://github.com/fbradyirl/webex_bot/pull/69
|
|
474
|
+
|
|
475
|
+
[pr71]: https://github.com/fbradyirl/webex_bot/pull/71
|
|
476
|
+
|
|
420
477
|
[i1]: https://github.com/fbradyirl/webex_bot/issues/1
|
|
421
478
|
|
|
422
479
|
[i2]: https://github.com/fbradyirl/webex_bot/issues/2
|
|
@@ -426,5 +483,3 @@ and off you go!
|
|
|
426
483
|
[i13]: https://github.com/fbradyirl/webex_bot/issues/13
|
|
427
484
|
|
|
428
485
|
[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
|
[](https://pypi.python.org/pypi/webex_bot) [](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 [
|
|
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.
|
|
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
|
|
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("
|
|
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
|
|
92
|
+
from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
|
|
114
93
|
Text, Image, HorizontalAlignment
|
|
115
|
-
from
|
|
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,
|
|
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,38 @@ 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
|
+
|
|
392
401
|
[1]: https://github.com/aaugustin/websockets
|
|
393
402
|
|
|
394
|
-
[2]: https://github.com/
|
|
403
|
+
[2]: https://github.com/WebexCommunity/WebexPythonSDK
|
|
395
404
|
|
|
396
405
|
[3]: https://developer.webex.com/docs/bots
|
|
397
406
|
|
|
@@ -403,6 +412,8 @@ and off you go!
|
|
|
403
412
|
|
|
404
413
|
[7]: https://eurl.io/#TeBLqZjLs
|
|
405
414
|
|
|
415
|
+
[8]: https://www.globoforce.net/microsites/t/awards/Redeem?client=cisco&setCAG=true
|
|
416
|
+
|
|
406
417
|
[pr43]: https://github.com/fbradyirl/webex_bot/pull/43
|
|
407
418
|
|
|
408
419
|
[pr46]: https://github.com/fbradyirl/webex_bot/pull/46
|
|
@@ -417,6 +428,12 @@ and off you go!
|
|
|
417
428
|
|
|
418
429
|
[pr59]: https://github.com/fbradyirl/webex_bot/pull/59
|
|
419
430
|
|
|
431
|
+
[pr62]: https://github.com/fbradyirl/webex_bot/pull/62
|
|
432
|
+
|
|
433
|
+
[pr69]: https://github.com/fbradyirl/webex_bot/pull/69
|
|
434
|
+
|
|
435
|
+
[pr71]: https://github.com/fbradyirl/webex_bot/pull/71
|
|
436
|
+
|
|
420
437
|
[i1]: https://github.com/fbradyirl/webex_bot/issues/1
|
|
421
438
|
|
|
422
439
|
[i2]: https://github.com/fbradyirl/webex_bot/issues/2
|
|
@@ -426,5 +443,3 @@ and off you go!
|
|
|
426
443
|
[i13]: https://github.com/fbradyirl/webex_bot/issues/13
|
|
427
444
|
|
|
428
445
|
[i20]: https://github.com/fbradyirl/webex_bot/issues/20
|
|
429
|
-
|
|
430
|
-
|
|
@@ -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 = ['
|
|
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.
|
|
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.
|
|
30
|
-
'Programming Language :: Python :: 3.
|
|
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.
|
|
48
|
+
version='0.6.0',
|
|
47
49
|
zip_safe=False,
|
|
48
50
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
|
|
4
4
|
Text, Image, HorizontalAlignment
|
|
5
|
-
from
|
|
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
|
|
3
|
+
from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
|
|
4
4
|
ImageSize, Image, Fact
|
|
5
|
-
from
|
|
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
|
|
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
|
|
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:
|
|
@@ -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
|
|
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
|
|
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
|
|
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,7 @@ import backoff
|
|
|
9
9
|
import certifi
|
|
10
10
|
import requests
|
|
11
11
|
import websockets
|
|
12
|
-
from
|
|
12
|
+
from webexpythonsdk import WebexAPI
|
|
13
13
|
|
|
14
14
|
try:
|
|
15
15
|
from websockets_proxy import Proxy, proxy_connect
|
|
@@ -45,7 +45,7 @@ class WebexWebsocketClient(object):
|
|
|
45
45
|
on_card_action=None,
|
|
46
46
|
proxies=None):
|
|
47
47
|
self.access_token = access_token
|
|
48
|
-
self.teams =
|
|
48
|
+
self.teams = WebexAPI(access_token=access_token, proxies=proxies)
|
|
49
49
|
self.device_url = device_url
|
|
50
50
|
self.device_info = None
|
|
51
51
|
self.on_message = on_message
|
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: webex_bot
|
|
3
|
+
Version: 0.6.0
|
|
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
|
[](https://pypi.python.org/pypi/webex_bot) [](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 [
|
|
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.
|
|
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
|
|
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("
|
|
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
|
|
132
|
+
from webexpythonsdk.models.cards import Colors, TextBlock, FontWeight, FontSize, Column, AdaptiveCard, ColumnSet, \
|
|
93
133
|
Text, Image, HorizontalAlignment
|
|
94
|
-
from
|
|
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,
|
|
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,38 @@ 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
|
+
|
|
371
441
|
[1]: https://github.com/aaugustin/websockets
|
|
372
442
|
|
|
373
|
-
[2]: https://github.com/
|
|
443
|
+
[2]: https://github.com/WebexCommunity/WebexPythonSDK
|
|
374
444
|
|
|
375
445
|
[3]: https://developer.webex.com/docs/bots
|
|
376
446
|
|
|
@@ -382,6 +452,8 @@ and off you go!
|
|
|
382
452
|
|
|
383
453
|
[7]: https://eurl.io/#TeBLqZjLs
|
|
384
454
|
|
|
455
|
+
[8]: https://www.globoforce.net/microsites/t/awards/Redeem?client=cisco&setCAG=true
|
|
456
|
+
|
|
385
457
|
[pr43]: https://github.com/fbradyirl/webex_bot/pull/43
|
|
386
458
|
|
|
387
459
|
[pr46]: https://github.com/fbradyirl/webex_bot/pull/46
|
|
@@ -396,6 +468,12 @@ and off you go!
|
|
|
396
468
|
|
|
397
469
|
[pr59]: https://github.com/fbradyirl/webex_bot/pull/59
|
|
398
470
|
|
|
471
|
+
[pr62]: https://github.com/fbradyirl/webex_bot/pull/62
|
|
472
|
+
|
|
473
|
+
[pr69]: https://github.com/fbradyirl/webex_bot/pull/69
|
|
474
|
+
|
|
475
|
+
[pr71]: https://github.com/fbradyirl/webex_bot/pull/71
|
|
476
|
+
|
|
399
477
|
[i1]: https://github.com/fbradyirl/webex_bot/issues/1
|
|
400
478
|
|
|
401
479
|
[i2]: https://github.com/fbradyirl/webex_bot/issues/2
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|