'API Exception Handling (Python)

I request data from an API in a while/try/except loop.

The general structure is like this:

while (True):
      try: 
          apiloop
      except:
          print(error)
      else:
          apiloop

If I try it like this it continues the loop after the first exceptions, as expected. But in the next round of exceptions, it crashes again. So my question is how do I get to catch the exception every time and still continue with my loop. Do I need to set maybe:

      finally:
            continue

I appreciate every help.

Regards, Angelo (Germany)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source