Hi,

You are very close :)

The problem is that the value a_calendar.id.text is not really the ID that
can be used for event query into that calendar.  Because a_calendar.id.text
actually is the URL formatted ID for that calendar, which looks like this -


http://www.google.com/calendar/feeds/default/allcalendars/full/dev-community-calendar%40google.com

Notice that, only the last segment of this URL ID is the actual calendar ID
that is expected from the event query.  You need to parse out that portion,
you can do something like this -

  id = a_calendar.id.text.split('/').pop()

Now you can pass this calendar "id" to CalendarEventQuery.

Hope it helps,
Austin

On Thu, May 1, 2008 at 6:52 PM, hbar <[EMAIL PROTECTED]> wrote:

>
> Hello all
>
> I apologize in advance if this is too basic - I haven't written much
> code in a while.  I am trying to write a program that will text query
> all (14) calendars for events that happen in a particular room of a
> community art center.  The problem I am having is getting the ids of
> the calendars dynamically (so I don't have to hard-code in each
> calendar).  My code so far is:
>
> feed = self.cal_client.GetAllCalendarsFeed()
>
>        for i, a_calendar in zip(xrange(len(feed.entry)), feed.entry):
>
>            #print a_calendar.id.text
>
>            calId = a_calendar.id.text
>            visibility = 'private'
>            projection = 'full'
>            user = 'monroestreetfinearts'
>            query = gdata.calendar.service.CalendarEventQuery(calId,
> visibility,
>                projection, text_query)
>
>            feed2 = self.cal_client.CalendarQuery(query)
>            for i, an_event in enumerate(feed.entry):
>                print '\tEvent: %s. %s' % (i, an_event.title.text,)
>
> (Note that this has been hacked together from the examples and other
> posts on this forum, so there may be unnecessary/confusing bits in
> here.)
>
> When I run this, I am getting the following "Bad Request" error:
> Traceback (most recent call last):
>  File "E:\Python25\calendar.py", line 243, in -toplevel-
>    main()
>  File "E:\Python25\calendar.py", line 239, in main
>    print sample.EventGrabber()
>  File "E:\Python25\calendar.py", line 187, in EventGrabber
>    queryData = self._FullTextQuery(rooms)
>  File "E:\Python25\calendar.py", line 122, in _FullTextQuery
>    feed2 = self.cal_client.CalendarQuery(query)
>  File "E:\Python23\Lib\site-packages\gdata\calendar\service.py", line
> 121, in CalendarQuery
>    converter=gdata.calendar.CalendarEventFeedFromString)
>  File "E:\Python23\Lib\site-packages\gdata\calendar\service.py", line
> 113, in Query
>    result = self.Get(uri, converter=converter)
>  File "E:\Python23\Lib\site-packages\gdata\service.py", line 513, in
> Get
>    raise RequestError, {'status': server_response.status,
> RequestError: {'status': 400, 'body': 'Invalid request URI.',
> 'reason': 'Bad Request'}
>
> I don't fully understand what I am doing, so please make any questions
> thorough.  Let me know if you need any other information.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to