class email.parser.FeedParser(_factory=email.message.Message, *, policy=policy.compat32)
Create a FeedParser
instance. Optional _factory is a no-argument callable that will be called whenever a new message object is needed. It defaults to the email.message.Message
class.
If policy is specified (it must be an instance of a policy
class) use the rules it specifies to update the representation of the message. If policy is not set, use the compat32
policy, which maintains backward compatibility with the Python 3.2 version of the email package. For more information see the policy
documentation.
Changed in version 3.3: Added the policy keyword.
-
feed(data)
-
Feed the
FeedParser
some more data. data should be a string containing one or more lines. The lines can be partial and theFeedParser
will stitch such partial lines together properly. The lines in the string can have any of the common three line endings, carriage return, newline, or carriage return and newline (they can even be mixed).
-
close()
-
Closing a
FeedParser
completes the parsing of all previously fed data, and returns the root message object. It is undefined what happens if you feed more data to a closedFeedParser
.
Please login to continue.