title: Why does it throw "KeyError" after API request?
body: <p>my Python code throws an Error after a short period of 5 to 7 requests or so called &quot;File &quot;c:/Users/xxx/Desktop/Webscraper.py&quot;, line 15, in programm
  zeit=(webseite[&quot;data&quot;]).</p>
  <p>KeyError: 'data'</p>
  <p>Why does it throw this error ?
  The key always should be there.</p>
  <pre><code>import requests
  import time
  import os
  
  def programm():
      while True:
          url=f&quot;https://api.nanopool.org/v1/eth/network/timetonextepoch&quot;
          webseite = requests.get(url).json()
          zeit=(webseite['data'])
          puffer=int(420)
  
          while zeit &gt; puffer:
              url=f&quot;https://api.nanopool.org/v1/eth/network/timetonextepoch&quot;
              webseite = requests.get(url).json()
              zeit=(webseite[&quot;data&quot;])
              puffer=int (420)
              print(&quot;Zeit zum DAG-Wechsel in Sekunden:&quot;,zeit)
              time.sleep(60) #Refresh Zeit
              while zeit &lt; puffer:
                  print(&quot;Neustart in&quot;,int(zeit)) # Zeit zur nächsten DAG Epoche in Sekunden
                  os.startfile(&quot;C:/Users/xxxx/Desktop/restart1.bat&quot;)
                  print(&quot;restart&quot;)
                  time.sleep(5000)
                  break
          break
  while True:
      programm()
      break
  </code></pre>