LinkedIn Reddit icon

Dunder Doc

by Valdir Stumm Jr

Handling Headers-Based Pagination on APIs with Python

The other day I was building a Python script to fetch some information about all my repositories on GitHub. Their API is pretty straightforward and well documented. Fetching my repos was as simple as: >>> import requests >>> response = requests.get("https://api.github.com/users/stummjr/repos") The thing is that such request gave me a list with all my repos on it. No info on pagination whatsoever on the response body. After a bit of research, I found out that GitHub APIs take advantage of the Link header to expose several pagination options.

My Favorite IPython Tricks

It’s no secret that IPython is my favorite Python shell. I am the guy who is always asking everyone “did you try IPython already?” as soon as I see they opening the regular Python shell. Yes, I know, you’d probably hate me. The reason I like it so much is that IPython makes it very easy for me to incrementally experiment when coding. I consider experimentation to be a crucial step when writing software, as it helps to reduce the unkowns in a problem or technology.