Unhex mixed content in python -


i have following code requests data via post:

response_data = requests.post('http://example.com/ajax', data={'foo':'bar'}).text print response_data  # "\u003cdiv class=\u0022red\u0022\u003e..." print type(response_data)  # <type 'unicode'> 

i'd following: <div class="red">

as see should pass param requests tell response should deserialized.

response_data.decode('string_escape') , response_data.encode('utf-8') not help.

as appeared json.loads(response_data) solves problem (though content not packed in json object, rather json string). because of inattention.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -