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' 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

python 3.x - PyQt5 - Signal : pyqtSignal no method connect -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)