Skip to content

Commit

Permalink
Merge pull request googleapis#36 from Yenthe666/patch-1
Browse files Browse the repository at this point in the history
[IMP] Spelling and formatting corrections
  • Loading branch information
Narcolapser authored Oct 14, 2016
2 parents 8b56ef8 + 330f611 commit 85ea9fd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions O365/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class Calendar( object ):
fetchEvents - legacy duplicate of getEvents
Variable:
events_url - the url that is actually called to fetch events. takes an ID, start, and end.
events_url - the url that is actually called to fetch events. takes an ID, start, and end date.
time_string - used for converting between struct_time and json's time format.
'''
events_url = 'https://outlook.office365.com/api/v1.0/me/calendars/{0}/calendarview?startDateTime={1}&endDateTime={2}'
time_string = '%Y-%m-%dT%H:%M:%SZ'

def __init__(self, json=None, auth=None):
'''
Wraps all the informaiton for managing calendars.
Wraps all the information for managing calendars.
'''
self.json = json
self.auth = auth
Expand All @@ -46,11 +46,11 @@ def getName(self):
return self.json['Name']

def getCalendarId(self):
'''Get calendar's GUID for office 365. mostly used interally in this library.'''
'''Get calendar's GUID for office 365. mostly used internally in this library.'''
return self.json['Id']

def getId(self):
'''Get calendar's GUID for office 365. mostly used interally in this library.'''
'''Get calendar's GUID for office 365. mostly used internally in this library.'''
return self.getCalendarId()

def fetchEvents(self,start=None,end=None):
Expand All @@ -73,19 +73,19 @@ def getEvents(self,start=None,end=None):
type is a struct_time. Default is a year from start.
'''

#If no start time has been supplied, it is assumed you want to start as of now.
# If no start time has been supplied, it is assumed you want to start as of now.
if not start:
start = time.strftime(self.time_string)

#If no end time has been supplied, it is assumed you want the end time to be a year
#from what ever the start date was.
# If no end time has been supplied, it is assumed you want the end time to be a year
# from what ever the start date was.
if not end:
end = time.time()
end += 3600*24*365
end = time.gmtime(end)
end = time.strftime(self.time_string,end)

#This is where the actual call to Office365 happens.
# This is where the actual call to Office365 happens.
response = requests.get(self.events_url.format(self.json['Id'],start,end),auth=self.auth)
log.info('Response from O365: %s', str(response))

Expand All @@ -94,7 +94,7 @@ def getEvents(self,start=None,end=None):
try:
duplicate = False

#checks to see if the event is a duplicate. if it is local changes are clobbered.
# checks to see if the event is a duplicate. if it is local changes are clobbered.
for i,e in enumerate(self.events):
if e.json['Id'] == event['Id']:
self.events[i] = Event(event,self.auth,self)
Expand All @@ -111,4 +111,4 @@ def getEvents(self,start=None,end=None):
log.debug('all events retrieved and put in to the list.')
return True

#To the King!
# To the King!

0 comments on commit 85ea9fd

Please sign in to comment.