title: Python Key Error exception when navigating api requests
body: <p>Everyone!</p>
  
  <p>The API I'm using has a limit of 50 objects per request so I'm using their scroll api to get the next page, but when I navigate through the last page its X-Next-Page header parameter does not exist and it throws this error </p>
  
  <blockquote>
    <p>KeyError: 'x-next-page'</p>
  </blockquote>
  
  <p>The code I'm using:</p>
  
  <pre><code>        while request.headers['X-Next-Page'] is not None:
              url = "https://api-2445582011268.apicast.io%s" % request.headers['X-Next-Page']
              request = requests.get(url, headers=self.headers)
              # break if api key hit usage limit
              if request.status_code == 403:
                  print("API key reached its limit")
                  break
  </code></pre>
  
  <p>So how do I check if request.headers has X-Next-Page properly? Thank you</p>