Pythonic handler for O365 Streaming & Push Notifications
Project description
O365-notifications is a pythonic implementation for the Notification services from Office 365. There are currently 2 ways for receiving notifications:
The versions on these are beta. For more details, see its documentation.
This approach is built on top of the current O365 package. You are recommended to look into its documentation for advance setups.
Notification strategies
As mentioned, there currently 2 supported notification types in O365: push and streaming.
As of now, this project relies on Outlook REST Beta API. But because this API is now deprecated and will be decommissioned, a transition to Microsoft Graph API is required. See this section for more details.
Push notifications
This project does not contain an implementation for this type of notification. Therefore, contributions are more than welcome.
O365 documentation on push notifications can be found here.
Streaming notifications
This project provides an implementation for this type of notification. A quick example on how to use it is found below:
import O365
from O365_notifications.base import O365NotificationHandler
from O365_notifications.constants import O365EventType
from O365_notifications.streaming import O365StreamingSubscriber
account = O365.Account(...)
mailbox = account.mailbox()
# create a new streaming subscriber
subscriber = O365StreamingSubscriber(parent=account)
# ... and subscribe to resource events
resource = mailbox.inbox_folder()
events = [O365EventType.CREATED]
subscriber.subscribe(resource=resource, events=events)
# subscriber keeps track of active subscriptions
assert len(subscriber.subscriptions) == 1
# implement a notification handler for customized behavior
subscriber.start_streaming(handler=O365NotificationHandler())
O365 documentation on streaming notifications can be found here.
Important note ⚠️
As communicated by Microsoft here, The v2.0 REST endpoint will be fully decommissioned in November 2022, and the v2.0 documentation will be removed shortly after.
What does it mean to this package?
Let’s see what it means for each one of the notification types:
Push notifications
Push notifications will be moved to Microsoft Graph, and go under the name of change notifications. Its documentation can be found here.
Transitioning to the Microsoft Graph should be a simple and straightforward task.
Streaming notifications
Unfortunately Microsoft will not port this service to Microsoft Graph. Therefore, as of November 2022, the current implementation in this project will be obsolete. More details on that can be found here.
Tests & linting
Run tests with tox:
# ensure tox is installed
$ tox
Run linter only:
$ tox -e lint
Optionally, run coverage as well with:
$ tox -e coverage
License
MIT licensed. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file O365-notifications-0.1.1.tar.gz
.
File metadata
- Download URL: O365-notifications-0.1.1.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.9.13 Linux/5.15.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5970decae24e659abafca64b0c18740303a298dce9ee99d31904b0c16d79200 |
|
MD5 | 6879f118a239b8d51ebe8846f442e6d5 |
|
BLAKE2b-256 | 5c4a69729d8dd7a2686d95a9895aafce7a8ef7fd221298476084f3b558660671 |
File details
Details for the file O365_notifications-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: O365_notifications-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.9.13 Linux/5.15.0-1017-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8820b9cca8119ae7e9ab4f063ee93253dc13c879e7695b7ecf8f55ddbf6c5599 |
|
MD5 | 762a4e15f791fe3d97bfe4180e03b835 |
|
BLAKE2b-256 | 51652bd70c7e229f4bb62f3fcc6b922e105f11fbed60d74dffbce727eae72fb3 |