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