image = gd_client.InsertPhotoSimple(album_url, title, title, filename, content_type='image/jpeg') except GooglePhotosException: print "There was an error processing: %s" % filename unprocessedimgs.append((title, filename)) return image if __name__ == '__main__': processedimg = False api = Api(BLOG, USER, PASSWORD) posts = api.read() for post in posts: # Delete the existing posts posturl = post['url-with-slug'] api.delete(post['id']) print "Deleted %s" % posturl blogfeed = feedparser.parse(open('@@rss.xml', 'rb').read()) gd_client = logon_to_picasaweb() albumfound = [album for album in gd_client.GetUserFeed(user=USER).entry if album.title.text == 'Blog Images'] if not len(albumfound) > 0: # Doesn't exist so create # a new photo album album = gd_client.InsertAlbum(title='Blog Images', summary='Images for kokorice.org') print "Created %s" % album.title.text else: album = albumfound[0] print "%s album already exists" % album.title.text if blogfeed: for entryidx, entry in enumerate(blogfeed.entries): entrysummary = ''
def testDelete(self): api = Api(BLOG, USER, PASSWORD) newpost = api.write_regular('title','body') post = api.read(newpost['id']) api.delete(post['id'])