Message236210
HTTP policy sounds as good a place as any, especially if/when it is blessed as a stable API.
Another related function is the undocumented http.cookiejar.split_header_words(), which seems more flexible than cgi.parse_headers(). It accepts multiple and comma-separated header values, splits on spaces as well as semicolons, and retains parameters without equal signs. Currently I have code that abuses the Message.get_params() and get_param() methods, which could probably benefit from split_header_words():
# Parse RTSP Transport headers like
# Transport: RTP/AVP/TCP;interleaved=0-1, RTP/AVP;unicast;client_port=5004
for value in header_list(self.headers, "Transport"): # Splits at commas
header = email.message.Message()
# Default get_params() header is Content-Type
header["Content-Type"] = value
[transport, _] = header.get_params()[0] # Gets the RTP/AVP part
mode = header.get_param("mode", "PLAY")
channel = header.get_param("interleaved")
if header.get_param("unicast") is not None:
port = header.get_param("client_port")
... |
|
Date |
User |
Action |
Args |
2015-02-19 02:39:32 | martin.panter | set | recipients:
+ martin.panter, barry, janssen, orsenthil, mgiuca, r.david.murray, flox |
2015-02-19 02:39:32 | martin.panter | set | messageid: <1424313572.38.0.0206356784897.issue3609@psf.upfronthosting.co.za> |
2015-02-19 02:39:32 | martin.panter | link | issue3609 messages |
2015-02-19 02:39:31 | martin.panter | create | |
|