LearnatHome / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

UnknownApiNameOrVersion: name: calendar version: v3 #215

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Problem can't be consistently reproduced. My application on Google App Engine 
takes a list of appointments and adds them to a calendar. If I use the exact 
same file it might cause this error one time, but not the next time. It doesn't 
happen on the first appointment either, but after a few, sometimes 3, sometimes 
18. 

What is the expected output? What do you see instead?
I expect all appointments to be inserted without errors.

What version of the product are you using? On what operating system?
Google Api Python Client v1.0

Please provide any additional information below.
This is the log from GAE (stripped of sensitive data):
name: calendar  version: v3
Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
    rv = self.router.dispatch(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
    return handler.dispatch()
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/s~appname/0000000000/appname.py", line 101, in post
    developerKey='xxxxxxxxxxxxxxxxxxxxxxx')
  File "/base/data/home/apps/s~appname/0000000000/oauth2client/util.py", line 120, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/base/data/home/apps/s~appname/000000000000000/apiclient/discovery.py", line 197, in build
    version))
UnknownApiNameOrVersion: name: calendar  version: v3

As far as I can see the error makes no sense, the api is calendar and the 
version is v3. The code that I used to create the request is a copy of the 
samples.

Original issue reported on code.google.com by franke.r...@gmail.com on 7 Nov 2012 at 1:05

GoogleCodeExporter commented 9 years ago
You may be hitting rate limiting for requests for the calendar discovery 
document. 
Try keeping a local copy of the discovery document and build the service object 
from that copy:

http://code.google.com/p/google-api-python-client/wiki/NonStandardDiscoveryDocum
ents#Local_Discovery_Docs

The discovery document for calendar v3 is here:

https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest

Original comment by jcgregorio@google.com on 7 Nov 2012 at 3:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanx for pointing me in that direction, I've changed my code accordingly and 
so far it's working, but is there any way for me to stress test that?

#Read local copy of api
f = file(os.path.join(os.path.dirname(__file__), "rest"), "r")
discovery = f.read()
f.close()

# Get the authorized Http object created by the decorator.
        http = decorator.http()        

# Construct a service from the local documents
        service = build_from_document(discovery,
                                      base="https://www.googleapis.com/",
                                      http=http, developerKey='XXXXXXXXXXXX')

        # Make a list of calendars
        calendar_list = service.calendarList().list(minAccessRole="writer").execute()

Original comment by franke.r...@gmail.com on 7 Nov 2012 at 3:52