in using the google calendar api (with python), I've been able to get back the variables I want, so I can export events into a text file. However, one variable (the location) is triggering an error and I'm not sure why.
This is straight from google's start code, with additions by me for the variables I want:
if not events:
print('No upcoming events found.')
for event in events:
start = event['start'].get('dateTime', event['start'].get('date'))
# print(start, event['summary'], event['description'], event['location'], event['iCalUID'])
print(start, event['summary'], event['location'], event['iCalUID'])
It prints a list of upcoming appointments including the location, but it stops and throws this error at me
Traceback (most recent call last):
File "tryingnewstuff.py", line 39, in <module>
print(start, event['summary'], event['description'], event['location'], event['iCalUID'])
KeyError: 'location'
Is this a problem with credentials/json? Am I using an old version of google calendar api? How do I check that? My json file says {"_module": "oauth2client.client", "scopes": ["https://www.googleapis.com/auth/calendar.readonly"], "
KeyError: 'location'. But from your replying, it seems that my understanding was not correct. So I have to remove my answer. I deeply apologize for my poor skill. - TanaikeIt is getting the summary and even the location just fine, in your situation, even when the property oflocationis included in the object of the element, the error occurs. If my understanding is correct, can you provide the whole script and values for completely replicating your issue? By this, I would like to confirm it. Of course, please remove your personal information. If you can cooperate to resolve your issue, I'm glad. - Tanaike