1
votes

If I already had an event on my google calendar, how can I get its location using Google calendar API in Python?

I tried

events = events_result.get('items', [])

to get all the parameters, but I couldn't find 'location'.

So what should I do to get the location of my events?

1
What's events_result? What does events have? Did you look at the documentation? - dibery

1 Answers

0
votes

The Try this API will show you the syntax of the event resource returned by the method Events: get:

{
 "kind": "calendar#event",
 "etag": "\"XXX\"",
 "id": "XXX",
 "status": "confirmed",
 "htmlLink": "https://www.google.com/calendar/event?XXX",
 "created": "2020-01-27T10:39:35.000Z",
 "updated": "2020-01-27T10:39:35.800Z",
 "summary": "event with location",
 "location": "home",
 "creator": {
  "email": "XXX",
  "self": true
 },
...
}

Consequently, you can retrieve the location in Python by adding the lines:

for event in events:
        print(event['location'])

If you cannot retrieve this location - probably it means that the event does not have a specified location.