forked from O365/python-o365
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begining experimentation into a radically different API.
I mused on github to @roycem90 about my idea of making O365 more pythonic. I finally had a chance when I wasn't doing a lot else to fiddle around with it and see how it would pan out. The results I have managed so far are quite satifying. This library could be made a lot more pythonic in a lot of ways. In terms of the code itself I want to leverage properties more and remove the need for methods like "getRecipient" and "setRecipient" and instead just use the property "recipient". Apply that to all of the objects and their data members and it should result in a pretty clear and consise API. The other way I want to make this a batteries included kind of library is inspired largely by roycem90's fluent inbox and message. Also inspiration for libraries like pandas. I've setup in this commit fluent_inbox with a __getitem__ method that allows for accessing the messages in the inbox super easily. I'm going to talk with roycem and @janscas about this and see if I can get their input on how to move forward.
- Loading branch information
Toben Archer
authored and
Toben Archer
committed
Apr 2, 2018
1 parent
39bc0bf
commit 78e5a5a
Showing
7 changed files
with
148 additions
and
48 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import O365 | ||
import time | ||
|
||
username = 'your username' | ||
password = 'your password' | ||
|
||
#send a message | ||
con = O365.login(username,password) | ||
message = con.newMessage() | ||
message.recipient = username | ||
message.subject = 'I made an email script.' | ||
message.body = 'Talk to the computer, cause the human does not want to hear it any more.' | ||
#message.send() | ||
|
||
#create a new event | ||
event = con.newEvent() | ||
event.subject = 'Coffee!' | ||
event.start = time.gmtime(time.time()+3600) #start an hour from now. | ||
event.end = time.gmtime(time.time()+7200) #end two hours from now. | ||
#event.save() | ||
|
||
print('print subject lines of first 10 messages:') | ||
for message in con.inbox[0:10]: | ||
print('\t'+message.subject) | ||
|
||
print('print the subject line of the first 10 even messages:') | ||
for message in con.inbox[1:20:2]: | ||
print('\t'+message.subject) | ||
|
||
print('print the subject line of the 7th message:') | ||
print('\t'+con.inbox[6].subject) | ||
|
||
print('printing the subject line of the first 5 messages:') | ||
for message in con.inbox[:5]: | ||
print('\t'+message.subject) |