http - How to get the raw content of a response in requests with Python? -
trying raw data of http response content in requests
in python. interested in forwarding response through channel, means ideally content should pristine possible.
what way this?
thanks much!
if using requests.get
call obtain http response, can use raw
attribute of response. here code requests
docs.
>>> r = requests.get('https://github.com/timeline.json', stream=true) >>> r.raw <requests.packages.urllib3.response.httpresponse object @ 0x101194810> >>> r.raw.read(10) '\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'