All in all, your first RESTful API in Python is about piecing together clear endpoints, matching them with the right HTTP ...
Stop piping grep into five other commands. It already handles most of that.