Part 0: Setup & Basic CRUD API
Howdy! Welcome to the Flask Rest API - Zero to Yoda, tutorial series. We will go through building a M...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for the tutorial!
There may be some error codes here:
The
add_movie()
function return the length of movies as the last id, so the first get request should returnid: 3
rather thanid: 2
(in the image of post response). And in other function, use index to access movie. So, I think should changereturn {'id': len(movies), 200
toreturn {'id': len(movies) - 1, 200
in the code.Sorry for my poor english.
Yes, that's right. I never realized it. Thanks for pointing it out.
Also, your English is good :)
I will update the article shortly.
I want to point another thing here, the response code should be 201 because we are creating an object, or Am I wrong?
I am having trouble installing pipenv. i added path variable also and now i cant run pipenv shell command. Can i do this using venv package management ?
(pls correct me if i am wrong , newbie here).
Thanks in advance
Yes sure, just two ways of doing same thing ;)
And one last thing when i import db from .db in model.py i get this error
-Attempted relative import beyond top level package .(its given by pylint in vscode).
Hi! Is there any chance someone can see what I am doing wrong? I can do get and post requests but put and delete give a 405 error. I have uploaded a screenshot. TIA!
Edit:
Don't know why the screenshot isn't showing and I can't even paste into this box. :(
Hey, I am not sure why you are having this problem.
You should be able to upload the screenshot using
upload image
icon.If for some reason you cannot. You can upload your screenshot somewhere and paste the link here.
Or maybe your project GitHub URL.
it's maybe because you forgot to specify the index in your put or delete request "localhost/movies/1"
Hi, thanks yes I didn't specify an index, so that might be it.
I just stumbled upon this three and a half years later. Alas, my comment and me meet again! I owe this seven part series my future. Passing by and paying dues? It deserves a Google review. This tutorial was foundational.
I basically copied the code from the tutorial.
when I try to POST using Postman, I get the following error
TypeError: TopLevelDocumentMetaclass object argument after ** must be a mapping, not NoneType
127.0.0.1 - - [17/Oct/2020 16:26:32] "POST /movies HTTP/1.1" 500 -
Absolutely love this tutorial series, thank you SO much!
One quick little typo I noticed that may throw off some beginners - you call the GET request on localhost:5000/ instead of localhost:5000/movies in postman
Super tutorial, a really practical walkthrough of working with Flask. Awesome job!
I am glad that you liked it 🙂
Hi, thanks for the tutorial, I enjoyed going through it. Do you think you could add another post about testing?
I am glad that you liked it.
I am planning to write about exception handling next and then testing :)
Thanks for the tutorial mate. It really helped me in understanding the working of Flask API.
Thanks for the tutorial
If you stuck at any part, you can check this repo.
I am getting null output when I send the get request
Nice tutorial! Thank you
I am glad that you liked it.
Please let me know if you have any suggestions
and also if you run into any issues while following
the series.
Ii'm getting a 'method not allowed' in the post method. i searched for answers but none of them solve my problem. how go through it?
same. just restart app.py