title: Assign output of 'requests' in python
body: <p>I was using the <code>requests</code> module to get some data in JSON form and I want to assign some of the output results into variables in the app; for example the results were like:</p>
  
  <pre><code>{'text': 'example',
   'type': 'text'}
  </code></pre>
  
  <p>I wanted to create variables that automatically store <code>text</code> as <code>example</code> and <code>type</code> as <code>text</code>.</p>
  
  <p>I tried to create a function and put the first code in it but it didn't work.
  The code for it was:</p>
  
  <pre><code>import requests
  import json
  import pprint
  
  def new_func():
  
      url = '***'
      r = requests.get(url)
      data = r.json()
      pprint.pprint(data)
      print(data)
  
  text = new_func.text()
  print(text)
  </code></pre>
  
  <p>However, it gives me an error as <code>text</code> is not a member of <code>new_func</code>.</p>
  
  <p><code>text</code> was part of the output as I mentioned before.</p>