Skip to content

Commit 7c5798b

Browse files
committed
Correcciones a returns y eliminacin de prints
1 parent 3c85591 commit 7c5798b

File tree

1 file changed

+4
-73
lines changed

1 file changed

+4
-73
lines changed

microsoftgraph/client.py

Lines changed: 4 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -178,46 +178,9 @@ def get_me_events(self):
178178
"""
179179
try:
180180
response = self._get('me/events')
181+
return response
181182
except Exception as e:
182183
return False
183-
try:
184-
event = {
185-
'attendees': '{}'.format(response['value']['attendees']),
186-
'categories': '{}'.format(response['value']['categories']),
187-
'created': '{}'.format(response['value']['createdDateTime']),
188-
'end': '{0}-TZ-{1} '.format(response['value']['end']['dateTime'], response['value']['end']['timeZone']),
189-
'hasAttachments': '{}'.format(response['value']['hasAttachments']),
190-
'iCalId': '{}'.format(response['value']['iCalId']),
191-
'id': '{}'.format(response['value']['id']),
192-
'importance': '{}'.format(response['value']['importance']),
193-
'All Day': '{}'.format(response['value']['isAllDay']),
194-
'cancelled': '{}'.format(response['value']['isCancelled']),
195-
'isOrganizer': '{}'.format(response['value']['isOrganizer']),
196-
'is reminder on': '{}'.format(response['value']['isReminderOn']),
197-
'last modification': '{}'.format(response['value']['lastModifiedDateTime']),
198-
'location': '{}'.format(response['value']['location']['address']),
199-
'online Meeting Url': '{}'.format(response['value']['onlineMeetingUrl']),
200-
'organizer name': '{}'.format(response['value']['emailAddress']['name']),
201-
'organizer email': '{}'.format(response['value']['emailAddress']['address']),
202-
'original End TimeZone': '{}'.format(response['value']['originalEndTimeZone']),
203-
'original Start TimeZone': '{}'.format(response['value']['originalStartTimeZone']),
204-
'recurrence': '{}'.format(response['value']['recurrence']),
205-
'reminderMinutesBeforeStart': '{}'.format(response['value']['reminderMinutesBeforeStart']),
206-
'response Requested': '{}'.format(response['value']['responseRequested']),
207-
'response Status': '{}'.format(response['value']['responseStatus']),
208-
'sensitivity': '{}'.format(response['value']['sensitivity']),
209-
'series Master Id': '{}'.format(response['value']['seriesMasterId']),
210-
'show As': '{}'.format(response['value']['showAs']),
211-
'start': '{0}-TZ-{1} '.format(
212-
response['value']['start']['dateTime'], response['value']['start']['timeZone']),
213-
'subject': '{}'.format(response['value']['subject']),
214-
'type': '{}'.format(response['value']['type']),
215-
'webLink': '{}'.format(response['value']['webLink']),
216-
}
217-
except Exception as e:
218-
print('Error while formatting downloaded data: ', e)
219-
return False
220-
return event
221184

222185
def create_calendar_event(
223186
self, subject, content,
@@ -296,9 +259,8 @@ def create_calendar_event(
296259

297260
try:
298261
response = self._post('me/events', json=body)
299-
print('---> ', response)
262+
return response
300263
except Exception as e:
301-
print("Error donwloading data: ", e)
302264
return False
303265

304266
def create_calendar(self, name):
@@ -317,7 +279,6 @@ def create_calendar(self, name):
317279
response = self._post('me/calendars', json=body)
318280
return response
319281
except Exception as e:
320-
print('Error while creating calendar: ', e)
321282
return False
322283

323284
def get_me_calendar(self, id_cal=None):
@@ -329,23 +290,8 @@ def get_me_calendar(self, id_cal=None):
329290
url = 'me/calendar/{}'.format(id_cal) if id_cal is not None else 'me/calendar'
330291
try:
331292
response = self._get(url)
332-
print('---> ', response)
333-
except Exception as e:
334-
print("Error donwloading data: ", e)
335-
return False
336-
try:
337-
return [{
338-
'id': c['id'],
339-
'canEdit': c['canEdit'],
340-
'canShare': c['canShare'],
341-
'canViewPrivateItems': c['canViewPrivateItems'],
342-
'changeKey': c['changeKey'],
343-
'color': c['color'],
344-
'name': c['name'],
345-
'owner': '{0}-{1}'.format(c['owner']['name'], c['owner']['address']),
346-
} for c in response['value']]
293+
return response
347294
except Exception as e:
348-
print('Error formating downloaded data: ', e)
349295
return False
350296

351297
def get_me_calendars(self):
@@ -355,23 +301,8 @@ def get_me_calendars(self):
355301
"""
356302
try:
357303
response = self._get('me/calendars')
358-
print('---> ', response)
359-
except Exception as e:
360-
print('Error downloading data: ', e)
361-
return False
362-
try:
363-
return [{
364-
'id': c['id'],
365-
'name': c['name'],
366-
'color': c['color'],
367-
'changeKey': c['changeKey'],
368-
'canShare': c['canShare'],
369-
'canViewPrivateItems': c['canViewPrivateItems'],
370-
'canEdit': c['canEdit'],
371-
'owner': c['canEdit'],
372-
} for c in response['value']]
304+
return response
373305
except Exception as e:
374-
print('Error formating downloaded data: ', e)
375306
return False
376307

377308
def send_mail(self, subject=None, recipients=None, body='', content_type='HTML', attachments=None):

0 commit comments

Comments
 (0)