Hope you all enjoyed! Realize I forgot to show how to delete from database, you can look here to find that information! flask-sqlalchemy.palletsprojects.com/en/2.x/queries/
Something I would personally really be interested in is how one would be able to install an LSP to enable professional code completion into a homegrown PyQT5 code editor. I realize this is pretty specific so no worries if it doesnt make a good tutorial topic.
This is awesome! I love that you left in all the little woopsie moments that we encounter. It's refreshing to see someone as good as you run into issues or forget quotes and address it on camera.
Very good intro to Flask. Thank you. Just one remark... You been using PUT to create new item and return 201. PUT should be used to replace existing item and returned status should be 200. To create new item you should use POST.
Every time I'm blown away by what a treasure your channel is... Not just the content, but also the way you talk us through the minor tips and shortcuts, explanation on even the most basic stuff, that helps a lot of the context fall into place.
I figured put would be used for updating a record, so for example an existing video will have its views and likes incremented. I expected post/create for adding new data, in this case a brand new video with 0 likes and 0 views.
As per RESTful API standard, PUT is used when the URI of the resource is known and POST is used when URI unknown. Meaning that if ID for the resourced is passed with the request, then PUT is used (which is the case in this video, also this is a rare case. Usually POST is used to create entities). If ID will be generated by the service, POST should be used. For a tutorial, this should be explained as this will definitely cost confusion for beginners.
Awesome tutorials Tim, thank you for putting these together! There's a lot of people who can program, but there are very few who can explain programming to people who don't already have a degree in computer science. Thanks for breaking it down!
Great tutorial! With your help I was able to get an API up and running for my practice program in no time. I had to install one more python package was missing from your requirements.txt. When we got to the test portion we used requests which needed to be installed. Just shouting it out in case anyone else gets snagged on that.
Tim, you're a blessing. Keep it up and leap forward... It would be great if we had a pair coding community around all the crops of developers blossoming as the ongoing fruit of this video and so many others. This was particularly useful for me as a professional Python developer. Be blessed Y'all.
I cant believe that I am able to learn all this for free, the lucidity with which you have explained everything is shocking! Thank you so much, you're fricking amazing ! !
I’m not a formally trained developer but have been hacking with languages like Perl, Shell, Ruby, Java and C for decades. Recently Python has been on my radar as a problem solving tool and this tutorial helped me implement an API after only 26 minutes of fast forwarding through this video - great info!
After watching the video: Hands down one of the best video for beginners, the thing with flask docs is that they are not very beginner friendly, but after watching this video I am now able to understand the official docs properly because my basics are cleared now. This video is the best video for a complete beginner in flask/API development. Thank you Tim for this wonderful video
Hey Tim.. POST method is used to CREATE or add Objects to DB, meanwhile PUT is for UPDATE data and PATCH is for PARTIAL UPDATE, i mean, just for change/update specific values. I hope will helpful.
Honestly I have to say, I'm up here at midnight watching and following along with a tech with tim video when I was originally just going to go and watch some Netflix. These videos are just too good to miss great job :). I also watched your how to earn money with programming and I'm actually getting a few orders in on Fiverr now so thank you!
The only people disliking this video are people who couldn't install pip or thought this was a music video AMAZING TUTORIAL... LANDED ME AN AMAZING JOB!!!!!! WHERE CAN I DONATE!?
This tutorial is pretty dense. I'm a beginner at using code to solve problems and I'll admit it took me a few sittings to get through everything in the video but I feel like I learned a lot. Thank you Tim!
Hey man, just one question, how do you manage your time? You clearly spend a lot of time learning/researching/recording. But how? This is legit inspiring.
Hey Tim, Excelent tutorial! This is the second time I'm watching it so this can sticks better on my head.. One thing that I didn't see on the comments (at least those I've readed) is that you need to use a virtual enviroment, so you don't install those dependences directly on your system.. But for every thing else, this tutorial es excelent! Thanks for sharing your knowledge with all of us! You are such a treasure for this comunity!
Thank you for this video! This is my first foray into APIs, and you've made the whole concept very easy to grasp! I tried implementing this code for the patch function, and it worked well: for arg in args: ----if args[str(arg)]: --------setattr(result, arg, args[str(arg)]) Thanks again! Subscribed!
I have one week experience in Python. This video is good and helped me to learn more about Flask, SQLite and SQLAlchemy. Thanks for sharing with me your knowledge. Keep it up. I liked, subscribed and commented.
Thanks for the detailed video. I spent a bit of time troubleshooting the delete function had to make a correction to the f-string in my file to make it operable. I had to use: return f"Video(name = {self.name}, views = {self.views}, likes = {self.likes})"
Great video, your explanation of the code really helped me not only grasp Flask, but it cleared up REST APIs for me quite a bit, you seem to have a talent for explaining this stuff. For some constructive criticism maybe let the code wait on the screen before you switch between files or the terminal and maybe slow down you're speaking a bit. These are more tips, not a criticism, it's a great video. I spend hours a day 5 days a week watching programming tutorials, and it's actually pretty common. I would rather you take a little more time than have the video be 5 minutes shorter.
I so needed to get a grip on using databases and generally API, to get familiarized, amazing, Thank you so much for putting this together Tim!! Much appreciated
in the patch method you can use this for updating the argument... for arg in args: if args[f'{arg}']: result.arg = args[f'{arg}'] thanks so much for making this resource
Thanks Tim this tutorial was fun to watch, it was compact and helpful. I really liked that u didnt cut ur errors, this encouraged me to focus more on the vid, because I tried to scan the code and search for errors while u typing. It was way more interactibe through this.
@1:00:00, when you are adding to the sqlite db, you can leave the id out. It automatically increments, if you are wanting to let it increment up I mean.
Thank you for this! I think this was a recent update. It kept throwing me errors when I specified the ID. After seeing your comment, I removed the ID and it solved my problem!
Thanks TIm. This was a great video. I decide to take on the task of doing the delete method myself and actually figured it out. Made a great "quote" backend.
This was so informative, i loved it!!!! Keep up the awesome work, you are one of my favourite programming RU-vidr out there that provides easy to understand and follow tutorials!!!!
Many Thanks! very well paced, easy to follow, very well delivered! one thing I think would add value to this could be covering basic (token-based) authentication. great tutorial!
For the Patch method, you can simply do something like: args = video_update_args.parse_args() for key in args: if args[key]: video = VideoModel.query.filter_by(id=id).update({key: args[key]}) db.session.commit()
If anyone face problem like {'message': "Did not attempt to load JSON data because the request Content-Type was not 'application/json'."} then in test file use json on data you passing on request. like that -> response = requests.put(BASE + "video/1", json={"likes":100, "name":"Nishnat", "views":2888})
Nice video Tim, You should do another video like this using FAST API. I personally have been digging through the FAST API docs and have been liking it so far, it would be interesting and valuable to hear your opinion on the new framework.
Thank you, Tim, for the video! I watched the whole thing and I enjoyed all of it (even the error debugging)! This helps me a lot, especially since I am new in using this!
I think the error debugging part is critical. I try to figure out where the error comes from when he says "I'll be right back' and half the time I get it, half the time I don't. Originally, I rarely figured it out. Really makes you confirm that you understand the process he is showing instead of just blindly following. Part of me wonders if he planned the mistakes on purpose to get us to do exactly this.
Thank you so much Tim. I am not new to python but you have introduced some interesting new topics to me. Also, your video flows really well and makes the introduction to new topics quite comprehensive. Thank you very very much for sharing this. You are a hero with no cape!!!
Great tutorial, Tim. I enjoyed it. I have some related problems about API, both on the client side and the server side. Could you help me out? When using an api as a client: 1. how do you deal with the ssl certificate when you try to connect to a secure server? 2. how do you hide the auth key and later retrieve the key in a secure way? 3. would you recommend requesting a new auth key from the server every now and then? On the server side: 4. what is the difference between sqlalchemy and flask-sqlalchemy? 5. would you recommend using just sqlite3 (writing plain sql statements) on smaller projects instead of sqlalchemy? Thank you.
Thank you so much, i was able to make an API in which I can take note of my home tasks, its SUPER, my intirefamily uses it and it dinamizes the work at home :D
this vid was so usefull and you helped me find my firt project. I ill try to make an rest api that will comunicate with a mysql database that i have made for my collage (its not a great project but it is something)