title: how to access the individual elements of a python <class 'requests.models.Response'> class
body: <p>My code accesses a light sensor via a python request:</p>
  
  <pre><code>address = 'https://api.particle.io/v1/devices/my_device_id/analogvalue'
  headers = {'Authorization':'Bearer {0}'.format(access_token)}
  vals = requests.get(address, headers=headers)
  </code></pre>
  
  <p>The code returns the following values:</p>
  
  <p>{"cmd":"VarReturn","name":"analogvalue","result":171,"coreInfo":{"last_app":"","last_heard":"2019-06-13T21:55:57.387Z","connected":true,"last_handshake_at":"2019-06-13T20:51:02.691Z","deviceID":"my_device_id","product_id":6}}</p>
  
  <p>Python tells me that this is a 'requests.models.Response' class and not a dictionary like I thought. </p>
  
  <p>When I try to access the 'result' value, I get error messages. Here are the various ways I have tried along with their error messages. </p>
  
  <pre><code>print(vals[2])
  </code></pre>
  
  <p>TypeError: 'Response' object does not support indexing</p>
  
  <pre><code>print(vals['result'])
  </code></pre>
  
  <p>TypeError: 'Response' object is not subscriptable</p>
  
  <pre><code>print(vals[2].json())
  </code></pre>
  
  <p>TypeError: 'Response' object does not support indexing</p>
  
  <pre><code>print(vals['result'].json())
  </code></pre>
  
  <p>TypeError: 'Response' object is not subscriptable</p>
  
  <p>I got the last two approaches (.json) from a answer here on stack overflow. </p>
  
  <p>Can anyone tell me how to access this result value or am I going to be forced to use regular expression?</p>
  
  <p>EDIT: With help from Sebastien D I added the following and was able to get the result I was looking for. </p>
  
  <pre><code>import json
  new_vals = json.loads(vals.content)
  print(new_vals['result'])
  </code></pre>