Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Look at Gmail filters' XML
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
def getProperties(entry, ns):
for app_property in entry.findall('apps:property', ns):
name = app_property.attrib['name']
if name in ('forwardTo', 'shouldTrash'):
yield name
ns = {
tree = ET.parse('test_py-mailFilters.xml')
for index, entry in enumerate(tree.findall('atom:entry', ns)):
app_property = entry.find('apps:property[@name="label"]', ns)
label = app_property.attrib['value'] if app_property != None else ''
print(','.join((str(index), label, *getProperties(entry, ns))))

This comment has been minimized.

Copy link

giampaolo44 commented Jul 2, 2016

ooh, che belle modifiche, grazie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.