'eventID TypeError exception trying to get google calendar event

I'm trying to create a script to search for a specific event in my calendar, but when I use the service.events().get(calendarId='primary', eventId=event_id).execute() method as the docs shows, I get a TypeError exception in the eventID argument.

In my event_id variable there is the actual id of an event that I have saved previously on a database with the events().list() method.

In the docs it's specified that a string argument is necessary but if I print(type(event_id)), it returns as a string.
I already checked that there is an event with that has eventID as its id.

Am I missing something?

This is the traceback of the error:

File "path\to\project\venv\lib\site-packages\googleapiclient\discovery.py", line 1019, in method
    raise TypeError('Got an unexpected keyword argument {}'.format(name))
TypeError: Got an unexpected keyword argument eventID


Solution 1:[1]

About service.events().get(calendarId='primary', eventId=event_id).execute(), when eventId of eventId=event_id is eventID, an error of TypeError: Got an unexpected keyword argument "eventID" occurs. I thought that the reason of your error message of TypeError: Got an unexpected keyword argument eventID is due to this.

In this case, please confirm your script. When it's eventID=event_id, please modify to eventId=event_id.

But, in this case, when your event_id is an invalid value, an error of Not Found occurs. Please be careful about this.

Note:

  • From I'm trying to create a script to search for a specific event in my calendar, if you want to retrieve the event list from a Calendar, you can also use the following sample script. This sample script is from Events: list.

      page_token = None
      while True:
          events = service.events().list(calendarId='primary', pageToken=page_token).execute()
          for event in events['items']:
              print(event['summary'])
          page_token = events.get('nextPageToken')
          if not page_token:
              break
    

Reference:

  • Events: get
    • When the sample script for python, you can see the following script.

        event = service.events().get(calendarId='primary', eventId='eventId').execute()
      

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tanaike