Created
February 8, 2018 00:27
-
-
Save sc137/b20e9fadcd3ed70ebcfc71e7d41e4d64 to your computer and use it in GitHub Desktop.
check your inbox, print subject lines, know when you need to switch over
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
# | |
# check_o365.py | |
# /sable cantus/ | |
# http://cantus.us/ | |
################### | |
""" | |
https://github.com/Narcolapser/python-o365 | |
$ pip3 install O365 | |
Save your credentials as an environment variable in .profile | |
export o365_email="your_email" | |
export o365_password="your_password" | |
$ while True; do python3 check_o365.py ; sleep 30; clear; done | |
""" | |
import os, time, datetime | |
from O365 import Connection, FluentInbox | |
email = os.getenv('o365_email') | |
password = os.getenv('o365_password') | |
# Setup a connection object | |
Connection.login(email, password) | |
# Create an inbox reference | |
inbox = FluentInbox() | |
# Fetch messages | |
for message in inbox.fetch_next(5): | |
# just print the subject | |
print(message.getSenderName(), message.getSubject()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment