Image for post
Image for post
image credit:

Planets and Webhooks: a simple Flask app

As a Developer Advocate for an API company, I spend a lot of time talking about APIs and webhooks and HTTP in general. Recently I’ve been focussing on HTTP tools, but I really wanted a very simple example API that I could use that would return JSON but really let me focus on the tools, not the API. So I created a “Planets and Webhooks” API with a couple of GET endpoints to return JSON data, and another endpoint to receive and log incoming webhook data.

The project is on GitHub: so you can also grab it yourself to use when testing out any of the HTTP tools or getting to know webhooks that I covered in my talk (this probably makes more sense if you’ve seen one of my HTTP talks/streams, but hopefully still can be useful by itself).

It very simply returns a little bit of info about a planet. For example:

You can use it to check out how different HTTP clients (curl, httpie and friends) handle JSON, or how tools like jq or fx can help.

The repo also includes some of the tools I usually mention:

Sometimes it is useful to have an endpoint that can receive and correctly acknowledge incoming webhooks without doing a whole lot else. This application has a simple GET/POST parameter logger on the /webhook endpoint. You can use Ngrok to allow an external webhook service such as Zapier to access your local running flask app.

Sharing the code I used in my demo is mostly useful for people who saw the demo but if it’s useful to you too, then great! I’m not the world’s finest python developer (yet) but I had fun building and using this application so let me know if you do too?

Originally published at LornaJane.

Polyglot programmer, technology addict, open source fanatic and incurable blogger (see

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store