A simple way to add pagination to your python requests when interacting with REST APIs
- Requests
pip install requests
- pandas
pip install pandas
This demo Python code makes use of the STARWARS API aka "SWAPI" which is a great resource for learning about the concept of REST APIS. There are various endpoints , but for this demo . i chose to use the 'planets' endpoint which contains exactly 60 records with various key value pairs.
NB : I have also attached a python script which contains a similar code should you prefer to run it as a script