title: Returning specific object from Python API call
body: <p>I do the majority of my automation work in PowerShell and I would like to start using Python but running into some issues with the json module.</p>
  <p>In PowerShell, lets say I write a basic function to return a list of users from a random API</p>
  <pre><code>Function Get-APIUser {
     # Set URI    
     $Uri = &quot;https://api.app.com/v1/users.json&quot;
     # Set Headers
     $Headers = @{'Api-Key'='Insert Key Here'}
     # Call API
     $Response = Invoke-RestMethod -uri $Uri -Headers $Headers -Method GET
     # Output Results
     $Response.links
  }
  </code></pre>
  <p>I call this function to return a specific user and store the returned object as a variable</p>
  <pre><code>$User = Get-APIUser | Where-Object {$_.email -eq &quot;Insert User Email Here&quot;}
  </code></pre>
  <p>Now all the information of that specific object is stored as a key value pair in the variable</p>
  <pre><code>id            : 123456789
  email         : email@email.com
  firstName     : John
  lastName      : Smith
  accountStatus : active
  </code></pre>
  <p>You can the call that variable <code>$User</code> and pull from specific key value pairs. For example</p>
  <pre><code>If ($User.accountStatus -ne &quot;active&quot;) {
      Try {
          # Do something
      }
      Catch {
      }      
  }
  </code></pre>
  <p>Python</p>
  <pre><code>import requests
  import json
  
  def get_apiuser():
      uri = 'https://api.app.com/v1/users.json'
      headers = {'Api-Key':'Insert Key Here'}
  
      try:
          response = requests.get(uri,headers=headers)
      except requests.exceptions.RequestException as error:
          print(error)
      
      jsonData = json.dumps(response)
      print(jsonData)
  </code></pre>
  <p>How would I got about returning just the data under <code>links ($Response.links)</code> like I specified in the PowerShell function. Also how would I sort through the results and store a user, for example, as a variable for later reuse?</p>
  <p>Thank you!</p>