File: etree_nzb.py

package info (click to toggle)
python-pynzb 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 152 kB
  • ctags: 59
  • sloc: python: 317; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 607 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pynzb.base import BaseETreeNZBParser, NZBFile, NZBSegment

try:
    import cElementTree as etree
except ImportError:
    try:
        from xml.etree import ElementTree as etree
    except ImportError:
        raise ImportError("You must have either Python 2.5 or cElementTree " +
            "installed before you can use the etree NZB parser.")

try:
    from cStringIO import StringIO
except ImportError:
    from StringIO import StringIO

class ETreeNZBParser(BaseETreeNZBParser):
    def get_etree_iter(self, xml, et=etree):
        return iter(et.iterparse(StringIO(xml), events=("start", "end")))