1. Reza Lotun
  2. pytweepml



PyTweepML - A Python Library for TweepML.

TweeML is an XML-based format to represent (hierarchical) groups of Twitter users. See tweepml.org for more information.

Installation: python setup.py install


from tweepml import parse_str, parse_filename tml = parse_str(xml) # xml is a TweepML document as a string tml = parse_filename(xml_file) # xml_file is the name of a TweepML document

# you can iterate over the TweepML object to get all TweepLists and Tweeps for item in tml:

if isinstance(item, TweepList):
# this is a sub list - you can iterate on this further print item.title print item.tags
elif isinstance(item, Tweep):
# single twitter entity - this is all possible information: print item.screen_name print item.id print item.title print item.tags

# modify the TweepmL object in place and when you're done, get back TweepmL xml_str = tml.serialize()

# or directly to a file tml.serialize_to_file(tweepml_filename)