Webex Python SDK

raw JSON →
2.0.6 verified Fri May 01 auth: no python

A Python SDK for interacting with the Webex (formerly Cisco Spark/Webex Teams) APIs. Version 2.0.6 is the latest, supporting Python 3.10+. The library was renamed from webexteamssdk in v2.0.0, dropping Python 2 support. Released on GitHub under the WebexCommunity organization. Release cadence is irregular, with minor patches every few months.

pip install webexpythonsdk
error ImportError: No module named webexpythonsdk
cause Library not installed.
fix
Run 'pip install webexpythonsdk'.
error webexpythonsdk.exceptions.ApiError: [401] Unauthorized
cause Invalid or missing API token.
fix
Ensure you have a valid Webex Bot Token and pass it to WebexAPI(token='...').
error TypeError: object of type 'NoneType' has no len()
cause Occurs if you try to iterate over api.rooms.list() without a valid token; api object is not properly initialized.
fix
Check that your token is set and correctly passed to the WebexAPI constructor.
breaking Library renamed from webexteamssdk to webexpythonsdk in v2.0.0. Existing code using 'from webexteamssdk import ...' will break. Migrate to webexpythonsdk.
fix Change your import to 'from webexpythonsdk import ...' and update requirements files.
breaking Python 2 support removed. Python 3.10+ required. Older codebases on Python 2 or 3.6-3.9 will not work.
fix Upgrade to Python 3.10 or later.
gotcha The 'max' parameter in list_messages() can cause confusion. It limits the total number of messages returned across all pages, not per page. If you set max=10, it will fetch up to 10 messages, but may make multiple API calls.
fix Understand that max controls total items. To limit per-page, use the 'limit' parameter (if available). For list_messages, 'max' is often the intended way.
deprecated The old 'webexteamssdk' library is no longer maintained. Any security patches or bug fixes are only applied to webexpythonsdk.
fix Switch to webexpythonsdk and update imports.

Initialize the SDK with your Webex Bot Token and list rooms. Replace 'your_token_here' with a valid token.

import os
from webexpythonsdk import WebexAPI

api = WebexAPI(os.environ.get('WEBEX_TOKEN', ''))
for room in api.rooms.list():
    print(room.title)