Skip to content

Commit

Permalink
Removed superflous license from the begining of each file. The
Browse files Browse the repository at this point in the history
project license is all that is needed. Espectially since the two
were not the same license.

Fixed a minor problem with message not working properly with
setRecipients. It was making a list in a list. Caught the problem
with my unit tests. I guess they are good for something.

Fixed Issue googleapis#13. Authentication is now expected to be a tuple in
all cases. This may develop into something more with isue googleapis#16 that
joincamp brought up. I'm exploring the use of OAuth2, but it is
quite a different world from what I'm used to. But so was many
things before I did projects like this.
  • Loading branch information
Toben Archer committed Jun 1, 2015
1 parent 345c1e5 commit 4b42d0e
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 122 deletions.
13 changes: 0 additions & 13 deletions O365/attachment.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

'''
This file contains the functions for working with attachments. Including the ability to work with the
binary of the file directly. The file is stored locally as a string using base64 encoding.
Expand Down
13 changes: 0 additions & 13 deletions O365/cal.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

import requests
import base64
import json
Expand Down
13 changes: 0 additions & 13 deletions O365/contact.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

import requests
import base64
import json
Expand Down
13 changes: 0 additions & 13 deletions O365/event.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

import logging
import json
import requests
Expand Down
19 changes: 3 additions & 16 deletions O365/group.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

from contact import Contact
import logging
import json
Expand All @@ -37,15 +24,15 @@ class Group( object ):
con_folder_url = 'https://outlook.office365.com/api/v1.0/me/contactfolders/{0}/contacts'
folder_url = 'https://outlook.office365.com/api/v1.0/me/contactfolders?$filter=DisplayName eq \'{0}\''

def __init__(self, email, password, folderName=None):
def __init__(self, auth, folderName=None):
'''
Creates a group class for managing all contacts associated with email+password.
Optional: folderName -- send the name of a contacts folder and the search will limit
it'self to only those which are in that folder.
'''
log.debug('setting up for the schedule of the email %s',email)
self.auth = (email,password)
log.debug('setting up for the schedule of the email %s',auth[0])
self.auth = auth
self.contacts = []
self.folderName = folderName

Expand Down
19 changes: 3 additions & 16 deletions O365/inbox.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

from O365.message import Message
import logging
import json
Expand All @@ -33,15 +20,15 @@ class Inbox( object ):
#url for fetching emails. Takes a flag for whether they are read or not.
inbox_url = 'https://outlook.office365.com/api/v1.0/me/messages'

def __init__(self, email, password,getNow=True):
def __init__(self, auth, getNow=True):
'''
Creates a new inbox wrapper. Send email and password for authentication.
set getNow to false if you don't want to immedeatly download new messages.
'''

log.debug('creating inbox for the email %s',email)
self.auth = (email,password)
log.debug('creating inbox for the email %s',auth[0])
self.auth = auth
self.messages = []

self.filters = ''
Expand Down
22 changes: 5 additions & 17 deletions O365/message.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

from O365 import Attachment
from O365 import Contact
import logging
Expand Down Expand Up @@ -181,10 +168,11 @@ def setRecipients(self,val):
'''
if isinstance(val,list):
self.json['ToRecipients'] = []
if isinstance(val,Contact):
self.addRecipient(val)
else:
self.json['ToRecipients'].append(val)
for con in val:
if isinstance(con,Contact):
self.addRecipient(con)
else:
self.json['ToRecipients'].append(con)
elif isinstance(val,dict):
self.json['ToRecipients'] = [val]
elif isinstance(val,str):
Expand Down
19 changes: 3 additions & 16 deletions O365/schedule.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Copyright 2015 by Toben "Narcolapser" Archer. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its documentation for any purpose
# and without fee is hereby granted, provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in supporting documentation, and
# that the name of Toben Archer not be used in advertising or publicity pertaining to distribution of
# the software without specific, written prior permission. TOBEN ARCHER DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
# SHALL TOBEN ARCHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

from O365 import Calendar
import logging
import json
Expand All @@ -33,10 +20,10 @@ class Schedule( object ):
'''
cal_url = 'https://outlook.office365.com/EWS/OData/Me/Calendars'

def __init__(self, email, password):
def __init__(self, auth):
'''Creates a Schedule class for managing all calendars associated with email+password.'''
log.debug('setting up for the schedule of the email %s',email)
self.auth = (email,password)
log.debug('setting up for the schedule of the email %s',auth[0])
self.auth = auth
self.calendars = []


Expand Down
4 changes: 2 additions & 2 deletions tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def get(url,auth,params=None):
class TestGroup (unittest.TestCase):

def setUp(self):
self.cons = group.Group('[email protected]','rakete')
self.folds = group.Group('[email protected]','rakete','Engineers')
self.cons = group.Group(('[email protected]','rakete'))
self.folds = group.Group(('[email protected]','rakete'),'Engineers')

def test_getContacts(self):
#Sanity check
Expand Down
4 changes: 2 additions & 2 deletions tests/test_inbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def get(url,auth,params):
class TestInbox (unittest.TestCase):

def setUp(self):
self.preFetch = inbox.Inbox('[email protected]','pass')
self.JITFetch = inbox.Inbox('[email protected]','pass',getNow=False)
self.preFetch = inbox.Inbox(('[email protected]','pass'))
self.JITFetch = inbox.Inbox(('[email protected]','pass'),getNow=False)

def test_getMessages(self):
#test to see if they got the messages already, should only work for prefetch
Expand Down
2 changes: 1 addition & 1 deletion tests/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get(url,**params):
class TestSchedule (unittest.TestCase):

def setUp(self):
self.val = schedule.Schedule('[email protected]','pass')
self.val = schedule.Schedule(('[email protected]','pass'))

def test_getCalendar(self):
self.val.getCalendars()
Expand Down

0 comments on commit 4b42d0e

Please sign in to comment.