Package email :: Module feedparser
[hide private]
[frames] | no frames]

Module feedparser

FeedParser - An email feed parser.

The feed parser implements an interface for incrementally parsing an email message, line by line. This has advantages for certain applications, such as those reading email messages off a socket.

FeedParser.feed() is the primary interface for pushing new data into the parser. It returns when there's nothing more it can do with the available data. When you have no more data to push into the parser, call .close(). This completes the parsing and returns the root message object.

The other advantage of this parser is that it will never throw a parsing exception. Instead, when it finds something unexpected, it adds a 'defect' to the current message. Defects are just instances that live on the message object's .defects attribute.

Classes [hide private]
A file-ish object that can have new data loaded into it.
A feed-style parser of email.
Variables [hide private]
  NLCRE = re.compile(r'\r\n|\r|\n')
  NLCRE_bol = re.compile(r'(\r\n|\r|\n)')
  NLCRE_eol = re.compile(r'(\r\n|\r|\n)$')
  NLCRE_crack = re.compile(r'(\r\n|\r|\n)')
  headerRE = re.compile(r'^(From |[!-9;-~]+:|[\t ])')
  NL = '\n'
  NeedMoreData = object()

Imports: re, errors, message