Julia Evans lays out her process for taking API responses in her browser’s dev tools and using them in her own programs/scripts:
- look in developer tools for a promising JSON response
- copy as cURL
- remove irrelevant headers
- translate it into Python
Some of you might be wondering – can you always do this?
The answer is sort of yes – browsers aren’t magic! All the information browsers send to your backend is just HTTP requests. So if I copy all of the HTTP headers that my browser is sending, I think there’s literally no way for the backend to tell that the request isn’t sent by my browser and is actually being sent by a random Python program.