title: Python request to get JSON
body: <p>This is my request.</p>
  
  <pre><code>h="API-AUTHENTICATION:key:secret"
  r=requests.get("https://URL", h)
  </code></pre>
  
  <p>This is the response:
  <code>&lt;Response [200]&gt;</code></p>
  
  <p>If I print the plain text of the request <code>(print(r.text))</code> I get this:</p>
  
  <pre><code>{
      "status": "OK",
      "data": [
          {
              "sort": 1,
              "parent_name": "Stocktake Demo",
              "timetables": [
                  {
                      "active": 1,
                      "from_date": "Nov 01, 2019",
                      "timetable_data": {
                          "monday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "tuesday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "friday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "wednesday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "thursday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "sunday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "saturday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ]
                      },
                      "type": 1,
                      "to_date": ""
                  }
              ],
              "name": "Stocktake Food",
              "parent_id": 137585,
              "parent_sort": 73,
              "image": null,
              "id": 137586,
              "description": null
          },
          {
              "sort": 1,
              "parent_name": "Main Category",
              "timetables": [
                  {
                      "active": 1,
                      "from_date": "Nov 01, 2019",
                      "timetable_data": {
                          "monday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "tuesday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "friday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "wednesday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "thursday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "sunday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ],
                          "saturday": [
                              {
                                  "to": "23:59",
                                  "from": "00:00"
                              }
                          ]
                      },
                      "type": 1,
                      "to_date": ""
                  }
              ],
              "name": "Main Subcategory",
              "parent_id": 117042,
              "parent_sort": 2,
              "image": null,
              "id": 117043,
              "description": null
          }
      ]
  }
  </code></pre>
  
  <p>If I do this:</p>
  
  <pre><code>a=json.loads(r.text)
  print(a.keys())
  print(a)
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>dict_keys(['status', 'data'])
  </code></pre>
  
  <p>How to parse this into a dictionary and iterate it. Now when I iterate it I only reach status and data fields. I try to iterate it like this:</p>
  
  <pre><code>def print_depth(a, start=0):
      for key, value in a.items():
          print(key, start + 1)
          if isinstance(value, dict):
              print_depth(value, start=start + 1)
  print_depth(a)
  </code></pre>