fixing error handling for json parsing
This commit is contained in:
@@ -13,9 +13,13 @@ class Event(object):
|
||||
|
||||
@staticmethod
|
||||
def get_from_gcal_api_json(json):
|
||||
print(json['start'].get('dateTime'))
|
||||
return Event(
|
||||
json['summary'] if 'summary' in json else "No Title",
|
||||
parse(json['start'].get('dateTime')),
|
||||
parse(json['end'].get('dateTime'))
|
||||
)
|
||||
try:
|
||||
print(json['start'].get('dateTime'))
|
||||
return Event(
|
||||
json['summary'] if 'summary' in json else "No Title",
|
||||
parse(json['start'].get('dateTime')),
|
||||
parse(json['end'].get('dateTime'))
|
||||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user