Python REST API Tutorial - Building a Flask REST API

Поделиться
HTML-код
  • Опубликовано: 26 сен 2024

Комментарии • 573

  • @TechWithTim
    @TechWithTim  4 года назад +118

    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/

    • @RomanReigns-ds8hs
      @RomanReigns-ds8hs 4 года назад +7

      We want to see a ml project in a live stream!!
      Any intermediate project using python!! Please.

    • @darth-revan881
      @darth-revan881 4 года назад

      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.

    • @pythonmacho9954
      @pythonmacho9954 4 года назад +1

      if possible cam make something using face recognition

    • @sleepybaby1265
      @sleepybaby1265 4 года назад

      more flask please!

    • @programmerrdai
      @programmerrdai 4 года назад +1

      Great Content

  • @amandathompson9697
    @amandathompson9697 4 года назад +56

    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.

    • @gethsun1
      @gethsun1 3 года назад

      I liked that as well good work Tim

    • @axlff5039
      @axlff5039 3 года назад

      Hi aMnanda

  • @peterhma2612
    @peterhma2612 2 года назад +16

    I like how Tim literally explains absolutely every single Jargon and definition in the most approachable way.

  • @sharanbabu2001
    @sharanbabu2001 4 года назад +122

    This is gold! Would love to see more intermediate topics like this.

    • @R4Y7
      @R4Y7 4 года назад +1

      @xOr It's simple logic, but introduces people to new concepts and stuff they can do.

    • @kilebox
      @kilebox 3 года назад +3

      It's not intermediate. He's literally explaining how to use pip install

    • @lckylke5751
      @lckylke5751 3 года назад +7

      @@kilebox concept of apis are def. a bit more advanced

  • @theteacher010
    @theteacher010 4 года назад +10

    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.

  • @joergboettiger2255
    @joergboettiger2255 4 года назад +22

    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!

    • @HackerNoon
      @HackerNoon 3 года назад

      Yeah, you're right and Tim did his job perfectly.

    • @didyoustealmyfood8729
      @didyoustealmyfood8729 2 года назад

      agreed.
      same is the case with "documentations"
      only a few docs are actually good. others just skim over things.

  • @RonnieRendel
    @RonnieRendel 2 года назад +11

    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.

  • @SH1xmmY
    @SH1xmmY 4 года назад +26

    I love the way Tim just codes and explains relatively great justifications of what he wrote...

  • @apoorvtewari1426
    @apoorvtewari1426 7 месяцев назад

    Thanks Tim for explaining it so well that no other resource was required to grasp the basics of FLASK

  • @helenadouglas-thomson6441
    @helenadouglas-thomson6441 4 года назад +5

    Hey Tim this is so serendipitous! I have a callback interview on Wednesday for a company that uses flask. Thank you from New Zealand

    • @amanahmed6057
      @amanahmed6057 2 месяца назад +1

      how was it , were you selected

  • @Hackafrique
    @Hackafrique 4 года назад +7

    This channel has really groomed me in coding. Thank you, Tim

  • @gamingllama7464
    @gamingllama7464 4 года назад +2

    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!

  • @warlock5624
    @warlock5624 4 года назад +21

    Trust me Tim, this is really good... straight forward video and easy to understand . And idk why only 1.1k likes 😑

    • @HackerNoon
      @HackerNoon 3 года назад +1

      Great to hear from you the same feelings as mine.

    • @didyoustealmyfood8729
      @didyoustealmyfood8729 2 года назад

      because everybody is a not a developer lmao.

  • @combardus9309
    @combardus9309 3 года назад +1

    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 ! !

  • @pedrolazdin6164
    @pedrolazdin6164 2 года назад +1

    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!

  • @jatinvashisht4293
    @jatinvashisht4293 2 года назад +1

    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

  • @sahilsarwar8444
    @sahilsarwar8444 3 года назад +1

    I started learning python a month ago and this channel is the best resource on all kinds of python related projects and resources. Thanks a lot Tim!

  • @sakshamkapoor5905
    @sakshamkapoor5905 4 года назад +25

    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.

  • @DatascienceConcepts
    @DatascienceConcepts 4 года назад +1

    One of the most useful topics on RUclips right now. Thanks for creating this!

  • @IONIZEDatom
    @IONIZEDatom 3 года назад

    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!

  • @margaret-in-cali
    @margaret-in-cali 11 месяцев назад

    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!

  • @LeighHart
    @LeighHart 3 года назад

    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!

    • @LeighHart
      @LeighHart 3 года назад

      I did circle back and watch the rest and learned a few more tricks like abort() and SQL - so definitely worth watching it all.

  • @itaysagy3756
    @itaysagy3756 2 года назад

    I was looking for a tutorial on how to create an API through Flask, coming from Express, and this video was a home run. Thanks!

  • @martinag6607
    @martinag6607 2 года назад

    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

  • @realdarthsin
    @realdarthsin 2 года назад

    Like the video you say? You're enabling a generation of programmers here. Great work!

  • @pnvkrm
    @pnvkrm 3 года назад

    Tim, I have been following all your flask tutorials playlist and gained good insights.Your way of teaching is simple and elegant, Thanks

  • @crater7531
    @crater7531 3 года назад +1

    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!?

  • @thoriqadillah7780
    @thoriqadillah7780 2 года назад +147

    Correction : you should use POST instead of PUT to add data. PUT is used if you want to update the existing data, not adding it

    • @andrewlittle1744
      @andrewlittle1744 2 года назад +6

      Put is used to add data and update.

    • @simondavidvgm
      @simondavidvgm 2 года назад +2

      Agreed, Thoriq

    • @thoriqadillah7780
      @thoriqadillah7780 2 года назад +20

      @@MoradorDeCalcadaif I'm not mistaken, PUT is used to update the entire data. PATCH is used to update certain field of the data

    • @RobertWestDavid
      @RobertWestDavid Год назад +2

      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.

    • @anjuthanm
      @anjuthanm Год назад +9

      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.

  • @putrisariasih22
    @putrisariasih22 4 года назад +1

    i always like the way u explain things to the core before we jump into the next part. it's always important. good work!

  • @aligd7040
    @aligd7040 Год назад

    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.

  • @vetoramireziii6218
    @vetoramireziii6218 2 года назад

    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.

  • @niyongaboeric
    @niyongaboeric 3 года назад

    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.

  • @dm-vh9yu
    @dm-vh9yu 3 года назад +1

    You explained everything perfectly. Finished my project because of this video, thank you!

  • @КостянтинКлепей
    @КостянтинКлепей 3 года назад

    Man, thanks a lot! it's really hard to find something as valuable as your videos for beginners like myself!

  • @BillusTinnus
    @BillusTinnus Год назад

    Holy that was an amazing video. I coded along all the way, learned A LOT. Liked + subscribed, thanks!

  • @inovexa4039
    @inovexa4039 4 года назад

    Tim if u see this ... You are my age!! But i hv a hell a lot of respect and love for you!! You are a legend//Much love from Sri Lanka!

  • @hoonjung2143
    @hoonjung2143 3 года назад +2

    Oh god, I am watching the first 12 minutes and this is exactly what I am looking for! Thank you so much already!

  • @lesz8832
    @lesz8832 4 года назад +17

    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.

    • @kiaaac
      @kiaaac 3 года назад +3

      Right! I think it's Tim's mistake or misunderstand. But I'm just satisfied I've been taught how to implement Flask Restful API in this video.

  • @rajkumarp1712
    @rajkumarp1712 11 месяцев назад +1

    Really appreciate the effort, Tim! Thank you.

  • @dbacademy4296
    @dbacademy4296 3 года назад +2

    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!

  • @moss4477
    @moss4477 2 года назад

    This was so informative, i loved it!!!!
    Keep up the awesome work, you are one of my favourite programming RUclipsr out there that provides easy to understand and follow tutorials!!!!

  • @themuchy1
    @themuchy1 2 года назад

    Great tutorial, watched this before reading any documentation on Flask. Really paints the whole picture

  • @andreanonali4557
    @andreanonali4557 4 года назад +2

    Man this is really legit. It will be interesting to see how to deploy this API
    Thank you ♥️

  • @SaiHemanthReddy-w9e
    @SaiHemanthReddy-w9e 6 месяцев назад

    Thanks man, you covered everyting I need to know to start my college project

  • @riyatiwari7178
    @riyatiwari7178 2 года назад

    Thank you so much Tim for this tutorial. Enjoyed learning every minute of it. Keep up the great work! Tim.❤

  • @DarasaDijito
    @DarasaDijito 7 месяцев назад

    Man you are the best,your video has helped me shape the world of Api in Education,i will send you an invitation to Tanzania so you could come

  • @ireneaguas5662
    @ireneaguas5662 3 года назад

    Thanks Tim! Your video was definitely easy to follow. Great content! Keep it up!

  • @Jatin-nr1bj
    @Jatin-nr1bj 4 года назад

    Thank you! Thank you! Thank You!
    Really needed a crisp and clear video on that.

  • @travisv6431
    @travisv6431 2 года назад

    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})"

  • @ianhogers565
    @ianhogers565 2 года назад

    Wow this was a great video, I came for flask and left with flask, sqlalchemy and lots of ideas! cheers

  • @hectoraponte9318
    @hectoraponte9318 4 года назад

    I just started your other flask tutorial series, this will make a great addition thanks Tim!

  • @JalerSekarMaji
    @JalerSekarMaji 3 года назад

    Wow, this is my first time can follow whole hour tutorial.
    Thankyou Tim!

  • @tymothylim6550
    @tymothylim6550 3 года назад

    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!

    • @lbb2rfarangkiinok
      @lbb2rfarangkiinok 2 года назад

      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.

  • @iggy9121
    @iggy9121 3 года назад

    Thanks for the video Tim, just had a great app idea and can use this to get me started with building the Flask API!

  • @Picker22
    @Picker22 4 года назад +1

    your 19 and you know so much thats so great

  • @flannn6
    @flannn6 2 года назад

    Hey JIM. Awesome video, dude! You're really good. Keep doing those awesome tutorials.

  • @Dav9261
    @Dav9261 4 года назад +1

    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.

  • @devtam
    @devtam 3 года назад +1

    Great tutorial, just finished it and feel like I learned a lot. Thanks TWT!

  • @godsgoodnessmmaduchukwu4550
    @godsgoodnessmmaduchukwu4550 23 дня назад

    Thank you so much for this video. It really broadened my understanding of the concepts.

  • @fabrizzioorderique2343
    @fabrizzioorderique2343 3 года назад

    exceptional tutorial!! clear explanations and examples and not afraid to debug -- keep it up!

  • @marcustapias2397
    @marcustapias2397 4 года назад

    Hi there from Brasil!
    Just passing by to say thanks for sharing your knowledge. You are helping me a lot!!

  • @ninobach7456
    @ninobach7456 10 месяцев назад +20

    I've wasted hours of my life trying to understand these concepts, when I simply could have watched your video. Thanks for sharing!

    • @ninobach7456
      @ninobach7456 10 месяцев назад +2

      Also, I enjoyed seeing you debug on the fly, that was really relateable

  • @manisarhimli1744
    @manisarhimli1744 3 года назад +2

    This video really saved my time. Thank you💚

  • @bhavyadhuria2032
    @bhavyadhuria2032 3 года назад +1

    This guy is only 19 years old and he is making APIs in python, that's impressive

  • @DM-zm2zb
    @DM-zm2zb 3 года назад

    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!!!

  • @chrishunter2806
    @chrishunter2806 2 года назад

    Thanks for the video Tim. Really enjoyed and easy to follow! :)

  • @mrpython6306
    @mrpython6306 2 года назад

    Successfully completed & and built a rest API. Thank you

  • @randomshit3480
    @randomshit3480 2 года назад +1

    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)

  • @abhinavgulati1
    @abhinavgulati1 3 года назад

    I usually don't comment on videos in RUclips but this one was really helpful thank you so much love from India ❤

  • @muhammadzufayri5656
    @muhammadzufayri5656 4 года назад +2

    Tim never dissapoints me... always update new video right on time when I need it. Great job Tim...

  • @johnnamtae9610
    @johnnamtae9610 4 года назад

    Love the video Tim. Keep up the great work!

  • @masterkey-do3jv
    @masterkey-do3jv Год назад +6

    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})

    • @cjay2020
      @cjay2020 Год назад +1

      Thank you so much you have saved a life of a beginner programmer

    • @robsonvecchi1100
      @robsonvecchi1100 3 месяца назад

      Thank you so much, man! I was looking for my mistake for an hour now. I'm really glad you posted this here, now everything works! Thanks!!!

  • @nadiadavari9788
    @nadiadavari9788 2 года назад

    it was incredible! Blessing! Thank you so much for your best explaining

  • @francescofranco97
    @francescofranco97 3 года назад

    Great video! Really appreciate your work, you are amongst the best at teaching code. Thanks a lot!

  • @MysteriousK69
    @MysteriousK69 4 года назад +2

    Love your content, way better than most courses on Udemy or Coursera.

  • @afonsomoura1165
    @afonsomoura1165 3 года назад

    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

  • @stanleychan3212
    @stanleychan3212 4 года назад +1

    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.

  • @shoaibsh2872
    @shoaibsh2872 4 года назад +2

    Lol I was looking for rest api on python tutorial yesterday. And today you just uploaded it 😅😅

  • @countryprogrammer4790
    @countryprogrammer4790 4 года назад +2

    @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.

    • @benjaminbong
      @benjaminbong 3 года назад

      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!

  • @denisefalcone7957
    @denisefalcone7957 Год назад

    Thank you Tim, you saved our university project

  • @diahidvegi8536
    @diahidvegi8536 3 года назад

    Tim.... Thank you so much. This saved me so much time. Your explanations and debugging are so super duper helpful. Thank you for making this.

  • @kvicar7419
    @kvicar7419 4 года назад +3

    This is what i've been waiting for!

  • @timcarter3799
    @timcarter3799 3 года назад

    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

  • @peterndukwe2666
    @peterndukwe2666 Год назад

    Really appreciate the energy you put into this video. Thank you

  • @harshavardhan7697
    @harshavardhan7697 3 года назад +1

    Clear and prefect as Always!!

  • @MakeDataUseful
    @MakeDataUseful 4 года назад

    Great stuff as always Tim!

  • @mvi6039
    @mvi6039 3 года назад

    Thank you, Tim! This is very helpful. I really enjoyed the video

  • @abulaman8713
    @abulaman8713 2 года назад

    Lifesaver bro, lifesaver, spared me from watching a dull college lecture

  • @armazza_official
    @armazza_official 4 года назад +1

    keep up with the great work!! much love from Egypt

  • @rafalpolanski2581
    @rafalpolanski2581 3 года назад

    Thanks Tim, great tutorial, learned a lot of useful stuff. Kudos to you

  • @ambarishkapil8004
    @ambarishkapil8004 4 года назад +6

    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.

  • @DanielJean
    @DanielJean 2 года назад

    Keep up the good work, man. Congrats.

  • @SalzDaniel
    @SalzDaniel 3 года назад

    Amazing tutorial, Tim. Great job!!

  • @danielhangan
    @danielhangan 3 года назад

    Hey TIm, thanks a lot. Really useful. Keep it coming

  • @TimmyTangents
    @TimmyTangents 3 года назад

    This was dope! Thanks for all the information! My ape mind was able to pick all of this up! Also, great name!

  • @igbokwelaurence5882
    @igbokwelaurence5882 3 года назад

    Nice work Tim. I recognized your voice from your Golang tutorial which i very much enjoyed. thanks for such free great content

  • @girishf469
    @girishf469 2 года назад

    This is the best tutorial for flask rest....!!

  • @mauriciosanchez813
    @mauriciosanchez813 3 года назад

    You are the anglo "Fazt", thank you Tim for your quality content, I'm new to python but i want to learn it so bad Thanks

  • @alexandermarthius5593
    @alexandermarthius5593 3 года назад

    Nice Tim...
    I love your tutorial, simple and easy to learn..
    thanks for sharing with us!!

  • @user-gf3hf5ri8b
    @user-gf3hf5ri8b Год назад

    Appreciate developers who make educational videos :3 :3