title: Python loop through api and append multiple objects as tuples to list
body: <p>I'm trying too loop through all pages of api and get multiples json objects and store these as tuples within the list and return the final list</p>
  
  <p>This works fine with only 1 object but I can't get it to work once i start adding multiple. I've tried various tweaks and changing for to while loops but can't seem to get to work</p>
  
  <pre><code>def star_wars_characters(url):
      all_names1 = []
      response1 = requests.get(url)
      data1 = response1.json()
  
      for x in data1['results']:
          all_names1.append(x['name'])
  
  
      while data1['next'] is not None:
          response1 = requests.get(data1['next'])
          data1 = response1.json()
  
          for x in data1['results']:
              all_names1.append(x['name'])
  
      return all_names1
  
  
  print(star_wars_characters("https://swapi.co/api/people/?page=1"))
  </code></pre>
  
  <p>I'm trying to achieve an output like below but for all pages. This is just results fro first page which I managed to return by changing for loops to while but couldn't get the remaining pages of data:</p>
  
  <pre><code>[('Luke Skywalker', '77'), ('C-3PO', '75'), ('R2-D2', '32'), ('Darth Vader', '136'), ('Leia Organa', '49'), ('Owen Lars', '120'), ('Beru Whitesun lars', '75'), ('R5-D4', '32'), ('Biggs Darklighter', '84'), ('Obi-Wan Kenobi', '77')]
  </code></pre>