title: Python (2.7.13) - I have a string that looks like an array
body: <p>I'm trapping an error but cannot extract what I want out of the returned message.
  Here's the code:</p>
  
  <pre><code>  except purestorage.PureHTTPError as response:
       print "LUN Creation failed:"
  
       print dir(response)
       print "args:{}".format(response.args)
       print "code:{}".format(response.code)
       print "headers:{}".format(response.headers)
       print "message:{}".format(response.message)
       print "reason:{}".format(response.reason)
       print "rest_version:{}".format(response.rest_version)
       print "target:{}".format(response.target )
       print "text:{}".format(response.text)
  </code></pre>
  
  <p>Here's the output:</p>
  
  <pre><code>LUN Creation failed:
  ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__unicode__', '__weakref__', 'args', 'code', 'headers', 'message', 'reason', 'rest_version', 'target', 'text']
  args:()
  code:400
  headers:{'Content-Length': '113', 'Set-Cookie': 'session=....; Expires=Wed, 05-Jul-2017 16:28:26 GMT; HttpOnly; Path=/', 'Server': 'nginx/1.4.6 (Ubuntu)', 'Connection': 'keep-alive', 'Date': 'Wed, 05 Jul 2017 15:58:26 GMT', 'Content-Type': 'application/json'}
  message:
  reason:BAD REQUEST
  rest_version:1.8
  target:array1
  text:[{"pure_err_key": "err.friendly", "code": 0, "ctx": "lun-name", "pure_err_code": 1, "msg": "Volume already exists."}]
  </code></pre>
  
  <p>I want to pull out <code>msg</code> and <code>pure_err_code</code> but the <code>text</code> isn't a list.
  The <code>[{ ... }]</code> is confusing me.  The <code>response.text[0]</code> is <code>[</code> and <code>response.text['msg']</code> throws an index error so this is acting like a string (afaIk).</p>