I am trying to filter out the response from a server.
Example:
b'RTSP/1.0 401 Unauthorized\r\nCSeq: 2\r\nWWW-Authenticate: Digest realm="Login to YR3EI16746R4O", nonce="8986086a1fv82683a0898142be7ze74"\r\n\r\n'
CSeq: 2 and nonce="8986086a1fv82683a0898142be7ze74f" are important to me. I should be able to read these answers to a variable. For Cseq could i do the following
if 'CSeq: 1' in data:
cseq = "CSeq: 1"
elif 'CSeq: 2' in data:
cseq = "CSeq: 1"
elif....
But this is not a proper way and does not solve the nonce= problem. How can I read the response from the server Ex: Read 2 chars after CSeq: or read 30 chars after nonce=" to a variable?
Thanks.