Work with the Webex APIs in native Python!
MIT License
Bot releases are hidden (Show)
Published by adamweeks 2 months ago
Documentation for the newly named package webexpythonsdk
is now hosted on github pages at https://webexcommunity.github.io/WebexPythonSDK/
Full Changelog: https://github.com/WebexCommunity/WebexPythonSDK/compare/v2.0.0...v2.0.1
Published by cmlccie 3 months ago
Welcome to the new webexpythonsdk
library! The latest release removes support for Python v2 and is compatible with Python v3.10+. The new Webex Python SDK replaces the previous webexteamssdk
; and with the exception of the Python version support and the name change, the two libraries are functionally equivalent. The new library is the recommended choice for new projects, and webexteamssdk
users are encouraged to migrate.
Published by sQu4rks over 2 years ago
This release is a hotfix that merges Pull request #175 into the main branch.
update
by @mallamanis in https://github.com/CiscoDevNet/webexteamssdk/pull/150
Full Changelog: https://github.com/CiscoDevNet/webexteamssdk/compare/v1.6...v1.6.1
Published by cmlccie over 4 years ago
In v1.6, we have updated all of the currently wrapped and supported Webex Teams API endpoints and closed out all existing issues that users opened on the v1.x releases. The library should now be up-to-date in supporting the Webex Teams APIs documented at developer.webex.com. It is not yet up-to-date in supporting the newer and broader Webex Meetings, Calling, and Devices APIs. We are tracking adding these additional API endpoints in issue #113, and we will work to add full support for all of the published Webex APIs in v2.x of the library.
With release v1.6, we are wrapping up active development on the v1.x release and shifting our focus to the next major release v2!
We have introduced one (1) breaking change in v1.6:
We have changed the function signature (parameter names) for the WebexTeamsAPI.guest_issuer.create()
method to align it with the developer documentation at developer.webex.com.
Previous method definition:
def create(self, subject, displayName, issuerToken, expiration, secret):
...
def create(self, sub, name, iss, exp, secret):
...
Published by cmlccie over 4 years ago
Version 1.5 adds several minor backend improvements, including:
Webex Tracking IDs are now prominently displayed for all API errors and warnings.
Example Error Message:
ApiError: [401] Unauthorized - The request requires a valid access token set in the Authorization request header. [Tracking ID: ROUTER_5F05F384-D9E9-01BB-00FF-4B0C804F00FF]
You can also access the Tracking IDs via the tracking_id
attribute available on the raised exception and warning objects.
api = webexteamssdk.WebexTeamsAPI(access_token="abc")
try:
api.people.me()
except webexteamssdk.ApiError as e:
print(e.tracking_id)
The webexteamssdk library now sends a custom User-Agent header (inspired by PIP's User-Agent header).
Example User-Agent Header:
webexteamssdk/1.5 {"implementation": {"name": "CPython", "version": "3.7.8"}, "distro": {"name": "macOS", "version": "10.15.5"}, "system": {"name": "Darwin", "release": "19.5.0"}, "cpu": "x86_64"}
Minor package and PEP8 improvements.
Published by cmlccie over 4 years ago
Version 1.4 adds support for the Admin Audit Events API; however, you should note that pagination is currently broken âšī¸ on responses from the /v1/adminAudit/events
API endpoint. Hopefully, the Developer Support Team will get this fixed quickly.
Published by cmlccie over 4 years ago
This minor update adds official support for adding attachments to messages via WebexTeamsAPI.messages.create()
thanks to @bradh11, @jianchen2580, @zhanto97, and @jwa1 đ!
@jpjpjp has created an excellent Webex Teams bot example that demonstrates using webhooks, Adaptive Cards, and response actions! đ
This release includes a beta of @sQu4rks Python Adaptive Cards, but please do not get too attached using this functionality directly from the Webex Teams SDK as we will be migrating this functionality to leverage @sQu4rks newer (and independently maintained) pyadaptivecards library.
Published by cmlccie about 5 years ago
Thanks to @sQu4rks đ, webexteamssdk
now (offically) supports configuration and use of an HTTP/HTTPS proxy! Just past a dictionary with the proxy configuration when creating your WebexTeamsAPI
connection object, and you are good to go. đ
>>> from webexteamssdk import WebexTeamsAPI
>>> proxy = {'https': 'http://<proxy_ip>:<proxy_port>'}
>>> api = WebexTeamsAPI(access_token=<your_access_token>, proxies=proxy)
Check out the requests documentation on Proxies for details on what should be in the proxies dictionary.
Published by cmlccie almost 6 years ago
ApiError
messages are now shorter, more insightful, and easier to inspect. đ
We have simplified the default string interpretation of the ApiError
messages. The simplified messages will use the message
attribute of the returned JSON (if present) to provide more insight as to why the request failed and will default to the generic error descriptions from the API docs if a message
attribute is not available.
Example of the New Message Format:
ApiError: [400] Bad Request - Message destination could not be determined. Provide only one destination in the roomId, toPersonEmail, or toPersonId field
The ApiError
exceptions now have several attributes exposed for easier inspection:
response
- The requests.Response
object returned from the API call.request
- The requests.PreparedRequest
used to submit the API request.status_code
- The HTTP status code from the API response.status
- The HTTP status from the API response.details
- The parsed JSON details from the API response.message
- The error message from the parsed API response.description
- A description of the HTTP Response Code from the API docs.To inspect an error, simply catch it in a try block and access the above attributes on the caught error:
from webexteamssdk import ApiError, WebexTeamsAPI
api = WebexTeamsAPI()
try:
api.messages.create()
except ApiError as error:
print(error.message)
See ApiError
in the API Docs for more details.
This enhancement addresses enhancement request #62 and resolves đ #68.
Published by cmlccie about 6 years ago
The new WebexTeamsDateTime
functionality had introduced a minor compatibility bug with Python v2. We squished it. đđ
Published by cmlccie about 6 years ago
With the name change from Cisco Spark to Webex Teams, ciscosparkapi
is now webexteamssdk
!
Don't worry! While it has received quite a bit of enhancing, the WebexTeamsAPI
wrapper works just like the CiscoSparkAPI
wrapper - only better:
We'll have more new capabilities to work-on and announce in the coming months, but this is a good start for now. đ
Published by cmlccie over 6 years ago
With this release, ciscosparkapi
now supports the Cisco Spark Events API! See the Events API and Event data model docs for more details.
Note: Compliance Officers may retrieve events for all users within an organization. See the Compliance Guide for more information.
feature: #55
Published by cmlccie over 6 years ago
In addition to fixing a bug ( #52 ) in the automated rate-limit handling and several testing improvements, this release also includes some substantial enhancements to the SparkData classes and how objects are created and returned by the API methods. đ
New Features:
SparkData
classes (Room
, Person
, Message
, etc.) are now composed classes created by inheriting from the SparkData
base class and type-specific mixin classes. This makes it easier to create your own composed classes (like we are doing with the enhanced data objects in the ciscosparksdk
package).CiscoSparkAPI
class now accepts an object_factory=
parameter that not surprisingly accepts an object factory function, which is responsible for creating the objects returned by the API methods. This allows you to easily create your own object classes and have them returned by the CiscoSparkAPI
methods. #EasilyExtensible đSparkRateLimitWarning
â ī¸ warning message when a rate-limit response is received. If you want to know if your code is being rate-limited, you can easily catch and log warnings to see đ what is going on.Updated feature docs on the new object extensibility are coming soon. I wanted to go ahead and get the rate-limit fixes, and the initial object code out so the development can move forward on the ciscosparksdk package.
Happy Coding!
Published by cmlccie almost 7 years ago
This update adds:
GeneratorContainer
's - now with slicing support! (for the #50 guys) - Only need the first 10 rooms, messages, or etc.? All of the package's list()
methods (return GeneratorContainers
) that can now be easily sliced to give you exactly what you need, for example:api = CiscoSparkAPI()
rooms = api.rooms.list(type='group')
print("Here are the first ten rooms:")
for room in rooms[:10]:
print(room)
Squashed a Python2 SparkData Bug - If you have tried to initialize a SparkData object (like a webhook) using Python v2, it was probably raising a TypeError
when you did. #SquishedIt đ â ī¸
Other Boring Stuff:
Published by cmlccie almost 7 years ago
Merged in pull request #49 from @dlspano with a fix to the package's rate-limit handling support where we (me) had accidentally removed the SparkApiError.retry_after
attribute that is critical to handling the rate-limit messages. đ¤Ļââī¸ -Thank you for catching this Dave!
This release also includes a few minor commits that were added to the package in support of the ciscosparksdk work that is underway.
Published by cmlccie almost 7 years ago
A couple of small feature updates in this release:
<spark data object>.json_data
returns a copy of the object's JSON data as an OrderedDict
.<spark data object>.to_dict()
returns a copy of the object's JSON data as a dict
object.<spark data object>.to_json()
returns a copy of the object's JSON data as an JSON string. Note: You can pass your favorite Python JSON encoding keyword arguments to this method (like indent=2
and etc.).ciscosparkapi
main package to more clearly articulate what classes and data are being exposed to you for your use. đPublished by cmlccie almost 7 years ago
All of the API wrappers and data models have been reviewed and updated to match the latest Cisco Spark API capabilities. -and- We have completed a significant internal restructuring to improve all of the API wrappers:
All API methods that accept parameters and post-data have been updated to consistently accept optional (**request_parameters
) keyword arguments. So, if Cisco releases an API update tomorrow with some new awesome parameter... You can go ahead and use it. We'll update the code later so that it shows up in your IDE as soon as we can.
New WebhookEvent - Webhook posts to your bot or automation can now be modeled via a new WebhookEvent
. Just pass the JSON body that Spark posts to your web service to the WebhookEvent()
initializer and you can use native dot-syntax to access all of the attributes.
Exceptions - some changes to what exceptions are raised...
TypeError
rather than an AssertionError
.ValueError
.Exception handling should be very straightforward now. The only exception that you should have to catch and handle at runtime should be the SparkApiError
's, which are returned when Cisco Spark responds with an error code. By the way, these were recently updated to show you the full request and response body, when an error occurs. Any other errors should show up and be addressed when you are writing and debugging your code.
Please open an issue if you experience any issues with the package. We have tested it extensively so hopefully you shouldn't! ...but the issue log is there just in case. đ¤ đ
-Thank You!
Published by cmlccie about 7 years ago
Micro release with some goodness!
We corrected issue #46 where SparkApiError
s were not printing / displaying correctly, and we enhanced them while we were in correcting the issue. SparkApiError
s now include the full details of the request and response that triggered / caused the error. No more having to go to your debugger to see what the offending request and response looked like. đ
Published by cmlccie about 7 years ago
If you have sent a few too many messages (actually usually a lot of messages) in a short period of time, you may receive a 429 response from Cisco Spark (which the ciscosparkapi package raises as a Python exception). While you can catch and handle these exceptions yourself... Why don't we just do that for you? đ
Now, when a rate-limit message is received in response to one of your requests, the ciscosparkapi package will automatically:
All of this should be transparent to the execution of your code, and you shouldn't need to make any modifications to your code to take advantage of the new functionality (unless you were already handling rate-limit responses, in which case you should be able to pull out that code and simplify your app đ ).
Experience: Your code should run as expected with the package handling any rate-limit responses that are received. Note that if your requests do trigger a rate-limit response, the wait times prescribed by Cisco Spark usually measure in the minutes (averaging about 5 minutes from my experience). It may appear that your code is running very slowly due to these wait times, but the good news is that your code is running and your requests are being handled as quickly as possible.
Absolutely. Should you desire to disable the automatic rate-limit handling, you can do so by setting the wait_on_rate_limit
parameter to False
when creating your CiscoSparkAPI connection object. Like So:
spark = CiscoSparkAPI(wait_on_rate_limit=False)
Rate limit messages (if you have disabled the automated handling) are now raised as a more specific SparkRateLimitError
instead of the more general SparkApiError
. Since SparkRateLimitError
is a sub-class of SparkApiError
, your code should still work as needed if you are catching rate-limit messages by catching SparkApiError
s. It's just a little easier to catch the rate-limit messages separately from the broader API errors.
As always, please raise an issue if you are experiencing any challenges or have ideas for enhancement.
Thank You!
Published by cmlccie about 7 years ago
@Deepar3292 corrected an errant HTTP method causing Team Updates to fail.