Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Cal API Python : Multiple delete with ExecuteBatch failure
    primarykey
    data
    text
    <p>I try to delete all the events of a calendar using the Google API for python. If I delete the events one by one this works fine but it's very long and not unoptimized so I try to do the same thing using ExecuteBatch that I use for insert a lot of entries in the calendar (and this works fine before the insert).</p> <pre><code>def DeleteAllEntryOfCalendar(calendar_client, name_calendar): #Request_feed for doing the delete request_feed = gdata.calendar.CalendarEventFeed() #Get the Uri of the cal we've to delete all entries uri = GetUri(calendar_client, name_calendar) feed = calendar_client.GetAllCalendarsFeed() for a_cal in feed.entry: if a_cal.title.text == name_calendar: calendar = a_cal #For each entry in the cal, do a delete request entry in request_feed query = gdata.calendar.client.CalendarEventQuery() query.max_results = 1000 feed = calendar_client.GetCalendarEventFeed(uri=uri, q=query) for an_entry in feed.entry: an_entry.batch_id = gdata.BatchId(text='delete-request') request_feed.AddDelete(entry=an_entry) entry = '' # submit the batch request to the server response_feed = calendar_client.ExecuteBatch(request_feed, uri+u'/batch') </code></pre> <p>And I got the error :</p> <pre><code>Traceback (most recent call last): File "c.py", line 253, in &lt;module&gt; DeleteAllEntryOfCalendar(client, name_calendar) File "c.py", line 187, in DeleteAllEntryOfCalendar response_feed = calendar_client.ExecuteBatch(request_feed, uri+u'/batch') File "/usr/local/lib/python2.6/dist-packages/gdata/calendar/client.py", line 432, in execute_batch return self.Post(batch_feed, url, desired_class=desired_class) File "/usr/local/lib/python2.6/dist-packages/gdata/client.py", line 681, in post entry.to_string(get_xml_version(self.api_version)), AttributeError: 'CalendarEventFeed' object has no attribute 'to_string' </code></pre> <p>I repeat that when I do the same to insert events this works fine. I've search a lot and tried a lot of possibilities and I can't do it work. If you've an idea...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload