Unpack Python URL Request
Question: I'm using:

    
    
    import requests
    
    data = 'text=great'
    
    print(requests.post('http://text-processing.com/api/sentiment/', data=data).text)
    

which returns:

    
    
    {"probability": {"neg": 0.30135019761690551, "neutral": 0.27119050546800266, "pos": 0.69864980238309449}, "label": "pos"}
    

and I want to browse that using the structure not just as a string of text.
How can I turn it into a dictionary?


Answer: Use the [`json()` method](http://docs.python-
requests.org/en/master/user/quickstart/#json-response-content) which would
load the JSON response content and return you a Python data structure:

    
    
    response = requests.post('http://text-processing.com/api/sentiment/', data=data)
    print(response.json())
    

