Google Cal API Python : Multiple delete with ExecuteBatch failure -


i try delete events of calendar using google api python. if delete events 1 one works fine it's long , not unoptimized try same thing using executebatch use insert lot of entries in calendar (and works fine before insert).

def deleteallentryofcalendar(calendar_client, name_calendar):     #request_feed doing delete     request_feed = gdata.calendar.calendareventfeed()     #get uri of cal we've delete entries     uri = geturi(calendar_client, name_calendar)     feed = calendar_client.getallcalendarsfeed()     a_cal in feed.entry:         if a_cal.title.text == name_calendar:             calendar = a_cal         #for each entry in cal, delete request entry in request_feed     query = gdata.calendar.client.calendareventquery()     query.max_results = 1000     feed = calendar_client.getcalendareventfeed(uri=uri, q=query)     an_entry in feed.entry:         an_entry.batch_id = gdata.batchid(text='delete-request')         request_feed.adddelete(entry=an_entry)             entry = ''      # submit batch request server     response_feed = calendar_client.executebatch(request_feed, uri+u'/batch') 

and got error :

traceback (most recent call last):   file "c.py", line 253, in <module>     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' 

i repeat when same insert events works fine. i've search lot , tried lot of possibilities , can't work. if you've idea...

use

gdata.calendar.data.calendareventfeed 

some objects in gdata python library have 2 versions , cannot mix them together.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -