'how to debug and test retry logic of API client in Python

I've just developed the primitive API client for Instagram based on "requests" library. The next goal is to implement retry logic for 400+ and 500+ error codes. There is a bunch of examples how to do this, but I'm wondering how to test the solution. Should it be some function which randomly decides weither to pass request to API portal or to return some error code instead? Or maybe there is somewhere on earth the unreliable API to practice on? or some server that genarates errors intentionally?



Sources

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

Source: Stack Overflow

Solution Source