webex-bot 0.5.2__py2.py3-none-any.whl → 0.6.0__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 CHANGED
@@ -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.0'
@@ -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):
webex_bot/webex_bot.py CHANGED
@@ -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,7 @@ 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
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 = WebexTeamsAPI(access_token=access_token, proxies=proxies)
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,28 +1,42 @@
1
- Metadata-Version: 2.1
2
- Name: webex-bot
3
- Version: 0.5.2
1
+ Metadata-Version: 2.4
2
+ Name: webex_bot
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.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
20
  License-File: LICENSE
20
- Requires-Dist: webexteamssdk==1.6.1
21
+ Requires-Dist: webexpythonsdk==2.0.4
21
22
  Requires-Dist: coloredlogs
22
23
  Requires-Dist: websockets==11.0.3
23
24
  Requires-Dist: backoff
24
25
  Provides-Extra: proxy
25
- Requires-Dist: websockets-proxy>=0.1.1; 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
26
40
 
27
41
  # Introduction
28
42
 
@@ -49,7 +63,7 @@ inside a LAN. This package instead uses a websocket to receive messages from the
49
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
50
64
  fit in a single response.
51
65
  * Restrict bot to certain users or domains.
52
- * 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.
53
67
 
54
68
  ## 🚀 Getting started
55
69
 
@@ -61,7 +75,7 @@ You can find a sample project, using OpenAI/ChatGPT with this library here: http
61
75
 
62
76
  ----
63
77
 
64
- **Only Python 3.9 is tested at this time.**
78
+ **Only Python 3.13 is tested at this time.**
65
79
 
66
80
  1. Install this module from pypi:
67
81
 
@@ -74,7 +88,7 @@ If you need optional proxy support, use this command instead:
74
88
  2. On the Webex Developer portal, create a new [bot token][3] and expose it as an environment variable.
75
89
 
76
90
  ```sh
77
- export WEBEX_TEAMS_ACCESS_TOKEN=<your bots token>
91
+ export WEBEX_ACCESS_TOKEN=<your bots token>
78
92
  ```
79
93
 
80
94
  3. Run your script:
@@ -97,7 +111,7 @@ proxies = {
97
111
  }
98
112
 
99
113
  # Create a Bot Object
100
- bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN"),
114
+ bot = WebexBot(teams_bot_token=os.getenv("WEBEX_ACCESS_TOKEN"),
101
115
  approved_rooms=['06586d8d-6aad-4201-9a69-0bf9eeb5766e'],
102
116
  bot_name="My Teams Ops Bot",
103
117
  include_demo_commands=True,
@@ -115,9 +129,9 @@ where EchoCommand is defined as:
115
129
  ```python
116
130
  import logging
117
131
 
118
- 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, \
119
133
  Text, Image, HorizontalAlignment
120
- from webexteamssdk.models.cards.actions import Submit
134
+ from webexpythonsdk.models.cards.actions import Submit
121
135
 
122
136
  from webex_bot.formatting import quote_info
123
137
  from webex_bot.models.command import Command
@@ -209,7 +223,8 @@ and off you go!
209
223
 
210
224
  # Help
211
225
 
212
- * 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].
213
228
  * Alternatively, open an issue or PR with a question on usage.
214
229
 
215
230
  # History
@@ -394,9 +409,38 @@ and off you go!
394
409
 
395
410
  * Introduce exact_command_keyword_match feature ([#59][pr59])
396
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
+
397
441
  [1]: https://github.com/aaugustin/websockets
398
442
 
399
- [2]: https://github.com/CiscoDevNet/webexteamssdk
443
+ [2]: https://github.com/WebexCommunity/WebexPythonSDK
400
444
 
401
445
  [3]: https://developer.webex.com/docs/bots
402
446
 
@@ -408,6 +452,8 @@ and off you go!
408
452
 
409
453
  [7]: https://eurl.io/#TeBLqZjLs
410
454
 
455
+ [8]: https://www.globoforce.net/microsites/t/awards/Redeem?client=cisco&setCAG=true
456
+
411
457
  [pr43]: https://github.com/fbradyirl/webex_bot/pull/43
412
458
 
413
459
  [pr46]: https://github.com/fbradyirl/webex_bot/pull/46
@@ -422,6 +468,12 @@ and off you go!
422
468
 
423
469
  [pr59]: https://github.com/fbradyirl/webex_bot/pull/59
424
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
+
425
477
  [i1]: https://github.com/fbradyirl/webex_bot/issues/1
426
478
 
427
479
  [i2]: https://github.com/fbradyirl/webex_bot/issues/2
@@ -431,5 +483,3 @@ and off you go!
431
483
  [i13]: https://github.com/fbradyirl/webex_bot/issues/13
432
484
 
433
485
  [i20]: https://github.com/fbradyirl/webex_bot/issues/20
434
-
435
-
@@ -0,0 +1,18 @@
1
+ webex_bot/__init__.py,sha256=S5gT3L7JqYWDSwjnLQa_VGARrFqlB4Q6IF_ElUCnWWs,95
2
+ webex_bot/exceptions.py,sha256=qs9yVitfJtvxwBMC8uCvTDOxUQ_oZjWFf1dU8Oaue14,740
3
+ webex_bot/formatting.py,sha256=jvPKym-z8CIJygpPVTVbt6vFXQo9_HQHpRDJB-nh-SI,382
4
+ webex_bot/webex_bot.py,sha256=pLNmcAP7J9ZG9QnEDZLYZJa_y1qtO5vudhT0fAi2stA,21282
5
+ webex_bot/cards/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ webex_bot/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ webex_bot/commands/echo.py,sha256=STY-MikBRjUteDK-g8G4GPB0V-Yi7siPN1DRMXrT-QU,3399
8
+ webex_bot/commands/help.py,sha256=n7sbnJHepNSqUgZ0-8PW37kbGsaqvGIk2-jYy6I7ch4,3470
9
+ webex_bot/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ webex_bot/models/command.py,sha256=MyThlDaEkGlj1fDE_i_wr79O3QboakimRme8yI744yo,5327
11
+ webex_bot/models/response.py,sha256=d4k2ohR5SUVzvuQzcnm7jQQVTMB0gH9Kz9y09vkoAaU,2545
12
+ webex_bot/websockets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ webex_bot/websockets/webex_websocket_client.py,sha256=kYepNP4gK0dddPndtK6ltCg52TYMhMtMHVKkxO15jTs,10618
14
+ webex_bot-0.6.0.dist-info/licenses/LICENSE,sha256=93eGb10xmgkBP2Fh_n0E9YDXe0c0oz-FsnAimXG0S4Y,1072
15
+ webex_bot-0.6.0.dist-info/METADATA,sha256=cOLj7txCMm0F0rwwtSmNb9Vf0T54sO6Jx3U6h--dPC0,14348
16
+ webex_bot-0.6.0.dist-info/WHEEL,sha256=AeO2BvogYWm3eGaHCvhzmUYt8ia7KfURiHzO_1atlys,109
17
+ webex_bot-0.6.0.dist-info/top_level.txt,sha256=q1Y0RtYYinR7oXSwL93cK59c2KN_CbMVca8MLWeF63M,10
18
+ webex_bot-0.6.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -1,18 +0,0 @@
1
- webex_bot/__init__.py,sha256=JfFcRVsDoAtttzwsMUmplNDZyvQ4gsjzQH9P1fx6XRo,95
2
- webex_bot/exceptions.py,sha256=qs9yVitfJtvxwBMC8uCvTDOxUQ_oZjWFf1dU8Oaue14,740
3
- webex_bot/formatting.py,sha256=jvPKym-z8CIJygpPVTVbt6vFXQo9_HQHpRDJB-nh-SI,382
4
- webex_bot/webex_bot.py,sha256=fUGMMIJVcwoP4fIaIyvvpSxoaMAl34dXSk0_QX44VGo,21222
5
- webex_bot/cards/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- webex_bot/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- webex_bot/commands/echo.py,sha256=YmeRVh56pzsj0_lRHDvgyrv6YqQQdRiusG65dHTh9qU,3397
8
- webex_bot/commands/help.py,sha256=s4buQxnmHijkqWiYs8RZ_H-yzi3EhAffSozPCGNndD0,3468
9
- webex_bot/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- webex_bot/models/command.py,sha256=HyZqS3oIEiWpHIEq8UvXPDHwd-opB-VWZxf2M3HKgvM,5325
11
- webex_bot/models/response.py,sha256=1U0EQv8O5R3-demaumxMExn278DG4AeQHhXP_g4xndk,2544
12
- webex_bot/websockets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- webex_bot/websockets/webex_websocket_client.py,sha256=QUTQUWgnBYg3bSZ857m_vM49Ns9GWHWT69TYP4U6R9I,10627
14
- webex_bot-0.5.2.dist-info/LICENSE,sha256=93eGb10xmgkBP2Fh_n0E9YDXe0c0oz-FsnAimXG0S4Y,1072
15
- webex_bot-0.5.2.dist-info/METADATA,sha256=-GLfltxFyjZyDkIUgN7BDZAyjSSzqMhmF4yWxiwxn2o,12401
16
- webex_bot-0.5.2.dist-info/WHEEL,sha256=fS9sRbCBHs7VFcwJLnLXN1MZRR0_TVTxvXKzOnaSFs8,110
17
- webex_bot-0.5.2.dist-info/top_level.txt,sha256=q1Y0RtYYinR7oXSwL93cK59c2KN_CbMVca8MLWeF63M,10
18
- webex_bot-0.5.2.dist-info/RECORD,,