Python regular expression

Posted by user3692739 on Stack Overflow See other posts from Stack Overflow or by user3692739
Published on 2014-05-30T20:26:14Z Indexed on 2014/05/30 21:27 UTC
Read the original article Hit count: 187

Filed under:
|

I have this HTTP Request and I want to display only the Authorization section (base64 Value) : any help ?

This Request is stored on a variable called hreq 

I have tried this :

reg = re.search(r"Authorization:\sBasic\s(.*)\r", hreq)
print reg.group()

but doesn't work

Here is the request :

HTTP Request: 
Path: /dynaform/custom.js 
Http-Version: HTTP/1.1 
Host: 192.168.1.254 
Accept-Language: en-US,en;q=0.5 
Accept-Encoding: gzip, deflate 
Referer: http://domain.com/userRpm/StatusRpm.htm 
Authorization: Basic YWhtEWa6MDfGcmVlc3R6bGH 

I want to display the value YWhtEWa6MDfGcmVlc3R6bGH Please I need your help thanks in advance experts

© Stack Overflow or respective owner

Related posts about python

Related posts about regex