Skip to main content

O365-notifications

PyPI version CI codecov code style: black license: MIT

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.

Release files for o365-notifications 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for o365-notifications 0.1.1
File Size Uploaded
O365-notifications-0.1.1.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for o365-notifications 0.1.1
File Interpreter ABI Platform
O365_notifications-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / O365-notifications-0.1.1.tar.gz

Download URL O365-notifications-0.1.1.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d5970decae24e659abafca64b0c18740303a298dce9ee99d31904b0c16d79200
BLAKE2b-256 checksum
How to use checksums
5c4a69729d8dd7a2686d95a9895aafce7a8ef7fd221298476084f3b558660671
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.9.13 Linux/5.15.0-1017-azure

Release files / O365_notifications-0.1.1-py3-none-any.whl

Download URL O365_notifications-0.1.1-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8820b9cca8119ae7e9ab4f063ee93253dc13c879e7695b7ecf8f55ddbf6c5599
BLAKE2b-256 checksum
How to use checksums
51652bd70c7e229f4bb62f3fcc6b922e105f11fbed60d74dffbce727eae72fb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.9.13 Linux/5.15.0-1017-azure

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page