john-charles
john-charles

Reputation: 1469

python email get values for multiple headers of the same name

I'm using python's email.message_from_string to parse a raw email message. However, the message has multiple "Recieved" headers in it. When I call message.keys() their are clearly several Recieved headers. But when I try message.get("Recieved") I just get "" a null string. How do you get the values of those instances of that header?

Upvotes: 3

Views: 1522

Answers (1)

wim
wim

Reputation: 362557

get_all(name[, failobj])

Return a list of all the values for the field named name. If there are no such named headers in the message, failobj is returned (defaults to None).

Source: http://docs.python.org/library/email.message.html#email.message.Message.get_all

Upvotes: 5

Related Questions