google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

googleapiclient.errors.UnknownApiNameOrVersion: name: calendar version: v3

Open abhi-hash256 opened this issue 3 years ago • 5 comments

When I hit the calendar API, it's giving an unknownApiNameOrVersion error. Currently, I am using google-api-python-client version 2.41.0. And python version is 3.9.1. which is the latest. Can you suggest what the problem is? Is it version related problem?

raise UnknownApiNameOrVersion("name: %s version: %s" % (serviceName, version)) googleapiclient.errors.UnknownApiNameOrVersion: name: calendar version: v3

abhi-hash256 avatar Mar 21 '22 14:03 abhi-hash256

Hello @abhi-hash256,

I'm not able to reproduce the issue using the environment that you shared. The following code works on my machine and on a docker image that I tested using google-api-python-client==2.41.0:

>>> from googleapiclient.discovery import build
>>> build('calendar', 'v3')
<googleapiclient.discovery.Resource object at 0x7f42cec87970>

The discovery document for calendar v3 exists here and is automatically shipped with the library.

Please can you share the code that you're using ?

parthea avatar Mar 24 '22 10:03 parthea

Hey @parthea Is it related to " static_discovery = False " after mentioning it in build to create a service object it started working. Otherwise, it was raising the error UnknownApiNameOrVersion: calendar version:v3

Previous Code service = build("calendar", "v3", credentials=credentials)

Changed Code service = build("calendar", "v3", credentials=credentials, static_discovery=False)

abhi-hash256 avatar Mar 24 '22 10:03 abhi-hash256

Thanks alot now its work properly for me you my time and money

radhey007 avatar Jun 14 '22 07:06 radhey007

Hey @parthea Is it related to " static_discovery = False " after mentioning it in build to create a service object it started working. Otherwise, it was raising the error UnknownApiNameOrVersion: calendar version:v3

Previous Code service = build("calendar", "v3", credentials=credentials)

Changed Code service = build("calendar", "v3", credentials=credentials, static_discovery=False)

The static_discovery argument definitely helped fix the error. Thanks alot!

bxavace avatar Jul 22 '22 11:07 bxavace

Thanks! @abhi-hash256 i made the chage and works perfectly!

JavierG123 avatar Jun 06 '23 19:06 JavierG123