Python FAST API Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 พ.ค. 2024
  • Welcome back to my channel! In this video, I will be showing you FastAPI which is a Python framework. As the name suggests, this allows us to make APIs in Python.
    💻 Checkout Intel's OpenVINO toolkit for FREE and start building and deploying AI/ML applications with the DevCloud for the edge! intel.ly/3whdRWo #sponsored
    📄 Resources 📄
    FAST-API Docs: fastapi.tiangolo.com/
    Fix Pip (Windows): • How to Install Pygame ...
    Fix Pip (Mac/Linux): • How to Install Pygame ...
    ⭐️ Timestamps ⭐️
    00:00 | Introduction
    02:22 | FAST-API Advantages
    04:49 | Installing FastAPI
    06:26 | Writing Our First FAST-API API
    10:58 | Running Our API
    14:00 | What is an API
    16:35 | JSON Explanation
    18:16 | Creating More Endpoints & GET Method
    19:19 | Path/Endpoint Parameters
    27:19 | Query Parameters
    35:19 | Request Body & POST Method
    44:12 | PUT Method
    50:42 | Delete Method
    53:15 | Status Codes and Error Responses
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    💰 Courses & Merch 💰
    💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p...
    👕 Merchandise: teespring.com/stores/tech-wit...
    🔗 Social Medias 🔗
    📸 Instagram: / tech_with_tim
    📱 Twitter: / techwithtimm
    ⭐ Discord: / discord
    📝 LinkedIn: / tim-ruscica-82631b179
    🌎 Website: techwithtim.net
    📂 GitHub: github.com/techwithtim
    🔊 Podcast: anchor.fm/tech-with-tim
    🎬 My TH-cam Gear 🎬
    🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
    🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
    📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
    🕹 Tripod: amzn.to/3hpSprv
    🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
    🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
    🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
    ☀️ Lights: amzn.to/2ApeiXr
    ⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
    🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
    📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
    📢 Speaker (Beats Pill): amzn.to/2XYc5ef
    🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
    🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
    🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
    💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
    💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
    🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
    🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih
    💸 Donations 💸
    💵 One-Time Donations: www.paypal.com/donate?hosted_...
    💰 Patreon: / techwithtim
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    ⭐️ Tags ⭐️
    -Tech With Tim
    - Fast API
    - Fast API Tutorial
    - Python API
    - Python FastAPI Tutorial
    ⭐️ Hashtags ⭐️
    #TechWithTiim #FastAPITutorial

ความคิดเห็น • 260

  • @worzell5169
    @worzell5169 ปีที่แล้ว +61

    43:49 for anyone wondering, he changed the function parameters to be def get_item(name: str = Query(None, title="Name", description="Name of item.", max_length=10, min_length=2)):

  • @s4lm._179
    @s4lm._179 3 ปีที่แล้ว +156

    Just when i thought of learning about API, there comes Tim

  • @thegimel
    @thegimel 3 ปีที่แล้ว +21

    Great video Tim!
    Would love to see a follow-up video where you show how to build a web micro-service (using FastAPI) for machine learning model inference

  • @kenny-kvibe
    @kenny-kvibe 3 ปีที่แล้ว +7

    This was epic, I was watching for 3 hours straight, and I've implemented a chilld class of FastAPI with a function that saves data into file.json when requests succeed.
    Great module I love it ! & great video, thank you very much! All that is missing is the cors, xss security things, let the research continue :D

  • @user-ke4yx6uw1r
    @user-ke4yx6uw1r 3 ปีที่แล้ว +2

    I have been working with Django and thinking about to give a try with fast api and flask.
    And here comes Tim with a fast api tutorial, Thank you Tim

  • @pauldickman4379
    @pauldickman4379 11 หลายเดือนก่อน

    The asterisk part just cracks me up. One of those things. Super great tutorial btw, thank you for taking so much time to make it high quality. Still holds up well 2 years later and that is hard to do nowadays.

  • @SeattleDataGuy
    @SeattleDataGuy 3 ปีที่แล้ว +6

    I have been looking to get into FastAPI and compare it to Flask(which is what I usually use for a lot of dev). This was a great in depth intro and more! Thank you.

  • @richisgood22
    @richisgood22 ปีที่แล้ว +1

    I wish I could upvote you more! Thank you so much for all of the help you've provided me over the years. You're amazing!

  • @martinag6607
    @martinag6607 2 ปีที่แล้ว +6

    I finally understand API and all thanks to you, Tim, thank you so so much for making these! Super grateful for your sharing of knowledge!! Thanks and stay so cool :)

  • @ajiteshkumar
    @ajiteshkumar 3 ปีที่แล้ว +5

    Tim is always here the same second i want to learn something. Thank you!

  • @joddden
    @joddden 2 ปีที่แล้ว

    I absolutely love you man, my genius hero! You coincidentally have videos on things I need for work AND things I'm just interested in that I thought was way too specific to me, like the NEAT series.

  • @Musava
    @Musava 3 ปีที่แล้ว +3

    Even though i know most basic and intermediate stuff, i still watch every single second of this video to not miss any information

  • @pinakastra
    @pinakastra 2 ปีที่แล้ว +3

    Just what I wanted to learn and that too in short n crisp (also enough detailed to get started). Thanks

  • @zarrycherry
    @zarrycherry 2 ปีที่แล้ว +91

    Great to follow except for the part where you have your face cam over the code your write. Also when you transition from query parameters to the next topic your code for get_item is different and as we follow along we still have our required fields when trying to get an item after our 2 items added through post, the get_item method you used simply asks for the item name.

    • @neclis7777
      @neclis7777 2 ปีที่แล้ว +4

      Yes, this exactly :). The video is great, but as you underline in the conclusion of the video, the important part is the difference between Path & Query which you seem to have cut in your video ! THank you for all your content Tim, keep it up !

    • @lifebelowyourmeans5454
      @lifebelowyourmeans5454 2 ปีที่แล้ว +2

      ya had the same problem. got kinda stuck lol.

    • @mawe4585
      @mawe4585 2 ปีที่แล้ว +8

      Mee too! Great video but this part around 26:00 is impossible to follow.

    • @dawit100100
      @dawit100100 2 ปีที่แล้ว +46

      here is the part of the code which is not visible on part around 26:00
      def get_item(item_id: int = Path(None, description="The Id of the item you'd like to view", gt=0, lt=2)):

  • @nomoremuda
    @nomoremuda 3 ปีที่แล้ว

    This is fantastic, Tim, I needed this for my current projects

  • @kemalcihanbastak8476
    @kemalcihanbastak8476 3 ปีที่แล้ว +32

    Hey Tim could you make tutorials about advanced topics like Kafka and Elasticsearch with Python.
    Btw great explanation.

  • @bh3553
    @bh3553 3 ปีที่แล้ว +77

    Somewhere around 25 minutes, your face cam is over the relevant code. Still very informative

    • @arunavamaulik19
      @arunavamaulik19 2 ปีที่แล้ว +2

      @Josh Yorko This comment needs to be pinned!

    • @JeffreyWagner7
      @JeffreyWagner7 4 หลายเดือนก่อน

      Better to just get rid of the face cam anyhow. Why do we need to see anyone's face between intro and outro?

    • @Studywise_io
      @Studywise_io หลายเดือนก่อน

      def get_item(item_id: int = Path(description="the id of the item you want to view", gt=0) ):
      return inventory[item_id]

  • @Nick-kd9no
    @Nick-kd9no 2 ปีที่แล้ว

    best short intro to FastAPI. Thank you Tim

  • @dandy6072
    @dandy6072 3 ปีที่แล้ว +8

    Please do some more fastapi videos, the library is still new and there isn't much tutorials out there. Great thing is that the documenting is really good.

  • @sanjeevKumar-eg6hp
    @sanjeevKumar-eg6hp ปีที่แล้ว

    Thanks for precise and to the point explanation of FAST-API. It was nice leaning at this pace

  • @sovietcat4825
    @sovietcat4825 3 ปีที่แล้ว +8

    great vid i didn't know you can do this until now... very infomative

  • @michakacprzak8984
    @michakacprzak8984 3 ปีที่แล้ว +1

    Really nice introduction to FAST API, thanks Tim

  • @parameshkumar6580
    @parameshkumar6580 4 หลายเดือนก่อน

    Thank You Tim ,Great video I like the way how you used dictionary first then introduced classes

  • @Meenimie
    @Meenimie 10 หลายเดือนก่อน

    Tim, you're the best at what you do.
    Please, keep it up because we need you.

  • @tomdanielsofficial
    @tomdanielsofficial ปีที่แล้ว

    Thank you so much for this great video! It helped me finish my homework for python class which would have been due tomorrow :)

  • @binaprajapati3593
    @binaprajapati3593 3 ปีที่แล้ว +12

    I am not first.
    I am not last.
    But when Tim uploads, I click fast
    😎😎

    • @ikennamanagwu9646
      @ikennamanagwu9646 3 ปีที่แล้ว +1

      You should have been a rapper... Eminem needs lessons

  • @Sciencedoneright
    @Sciencedoneright 3 ปีที่แล้ว +14

    Dude. You're reading our minds. I was just thinking about learning FastAPI and, you made this video!!!

    • @aakashjana6225
      @aakashjana6225 3 ปีที่แล้ว +2

      we only think of what they feed to us. not a big surprise nowadays anymore

    • @sineadward5225
      @sineadward5225 ปีที่แล้ว

      @@aakashjana6225 What technologies are you working with/do you enjoy working with?

    • @aakashjana6225
      @aakashjana6225 ปีที่แล้ว

      @@sineadward5225 interestingly these days I am working with system verilog ( hardware description language) to work with FPGAs. Should take a look at it, it's very interesting fir chip design.

  • @EnglishRain
    @EnglishRain ปีที่แล้ว +1

    Thanks a TON for Zooming in!

  • @rasheedibraheem6839
    @rasheedibraheem6839 ปีที่แล้ว

    A great tutorial! Very helpful, many thanks Tim

  • @iscodav
    @iscodav 2 ปีที่แล้ว

    Thank you very much. That was a great experience to get to start with FastAPI

  • @yassinebenazzouz7170
    @yassinebenazzouz7170 ปีที่แล้ว

    just watched your flask restful api and this one, perfect !

  • @k2theboss47
    @k2theboss47 2 ปีที่แล้ว +1

    Thanks Tim, this is insanely valuable!!!

  • @whichdude420
    @whichdude420 3 ปีที่แล้ว +2

    Glad more people are trying out FastAPI ^^

  • @romanviktordvorak76
    @romanviktordvorak76 ปีที่แล้ว

    Great introduction to FastAPI. Thank You!

  • @Betty-dc9ky
    @Betty-dc9ky ปีที่แล้ว

    Thank you Tim for this tutorial. Found it really useful.

  • @rembautimes8808
    @rembautimes8808 2 ปีที่แล้ว +2

    Bye bye Django. Thanks for this excellent tutorial. Exactly what I was looking for and the automated documentation is a big win. Did the trifecta- liked , subscribed and comment ( From Singapore)

  • @efajunk
    @efajunk ปีที่แล้ว

    Thank you very much. Absolutely useful info about this framework!

  • @The1neo34
    @The1neo34 ปีที่แล้ว

    Thank you! Best video on APIs I have watched to date

  • @emailvinz
    @emailvinz ปีที่แล้ว

    Great tuto as usual, thanks Tim !

  • @NMNaufaldo
    @NMNaufaldo 2 ปีที่แล้ว

    Waw I was just amazed how fast & easy to build an API with this framework 🚀

  • @gecsus
    @gecsus 2 ปีที่แล้ว +9

    Tim, at time 26:00 you are adding things we can't see for Greater than >. Your popover window either covered it or you were showing the wrong part of the screen. So we are unable to type what you typed.
    Generally, your videos are really good, so please review them carefully.

    • @ignabelitzky
      @ignabelitzky ปีที่แล้ว +5

      def get_item(item_id: int = Path(None, description = "The ID of the item you'd like to view.", le=1)):

  • @nigeldavis
    @nigeldavis 2 ปีที่แล้ว

    i just started a job where im going to be using FastAPI this is perfect!

  • @procode6881
    @procode6881 3 ปีที่แล้ว +5

    Was waiting waiting for this ...first one to get it!

  • @shnuiiwithdoublei
    @shnuiiwithdoublei 2 หลายเดือนก่อน +1

    Such an underrated video

  • @mysneekers5862
    @mysneekers5862 3 ปีที่แล้ว

    This guy is great! Thanks for your tutorials.

  • @KAREKINFPV
    @KAREKINFPV ปีที่แล้ว

    This is incredible! Thank you so much!

  • @alexnefayne4266
    @alexnefayne4266 ปีที่แล้ว

    Thanks Tim another great tutorial i find these so usefull

  • @samozturk8276
    @samozturk8276 2 ปีที่แล้ว +10

    Hello Tim, nice tutorial. But at some parts, I couldn't see the code because of the portrait :D Are there any repo for this or something like that?

  • @arrvind7385
    @arrvind7385 2 ปีที่แล้ว

    Tons of thanks , Really Superb explanation

  • @saloniparekh3999
    @saloniparekh3999 3 ปีที่แล้ว +2

    wow this was really great, can you also post videos for DS and Algos to prepare for job interviews.

  • @malachimathins9390
    @malachimathins9390 6 หลายเดือนก่อน

    Great Video Tim
    "Hey everyone! I just wanted to share my experience with different code editors. I've tried various IDEs, including VS Code and Visual Studio,
    and I ran into some issues that were frustrating to deal with. so its best to use sublime text like in the video

  • @emilijamarjanovic5497
    @emilijamarjanovic5497 2 ปีที่แล้ว

    Great tutorial, thank you very much!

  • @xXJM01Xx
    @xXJM01Xx ปีที่แล้ว

    Great video, I knew this was a great library that I should learn and the video did a very good job of getting my feet wet.

  • @markruiz9397
    @markruiz9397 2 ปีที่แล้ว +1

    Please keep the FastAPI material coming!!!

  • @milesmatic2872
    @milesmatic2872 3 ปีที่แล้ว

    Awesome tutorial, very helpful!

  • @Robizd1
    @Robizd1 2 ปีที่แล้ว +21

    You could have used PATCH method instead of PUT method for updating items. PATCH allows you to partially update item. Btw nice video

    • @yessirski7868
      @yessirski7868 4 หลายเดือนก่อน

      do they work the same in terms of the perameters?

  • @emmanouilmorfiadakis118
    @emmanouilmorfiadakis118 2 ปีที่แล้ว

    Very Good Explanation.Thank you

  • @sanduchicu7545
    @sanduchicu7545 3 ปีที่แล้ว

    Very helpful thx a lot. gl with ur channel in the future ;)

  • @JohanMonard
    @JohanMonard 2 ปีที่แล้ว

    Great tutorial, could you add a section showing how to secure API access with user login/pwd?

  • @hackynawhat
    @hackynawhat 3 ปีที่แล้ว

    This was what I actually needed 😊😊😊

  • @evanshlom1
    @evanshlom1 2 ปีที่แล้ว

    This is a great intro to fastapi

  • @uptightowl3801
    @uptightowl3801 3 ปีที่แล้ว +3

    TIM PLEASE be my dad 😩😩😩 these tutorials are amazing. I haven’t watched it yet but I saw the channel and clicked

  • @abdallahkharoby4180
    @abdallahkharoby4180 2 ปีที่แล้ว

    Your are really awesome thank you very much, hope you make one day a video about scrapy library so that we can scrap an api from any website we want.

  • @samozturk8276
    @samozturk8276 2 ปีที่แล้ว +12

    @50:51 Tim forgot to type "from fastapi import Query" on top of the code.

  • @riperboyxl3216
    @riperboyxl3216 ปีที่แล้ว

    dude this tutorial is GREAT

  • @EpicGamer-ux1tu
    @EpicGamer-ux1tu ปีที่แล้ว

    Great vid Tim! Thanks.

  • @noobypro4560
    @noobypro4560 3 ปีที่แล้ว

    Thanks tim for providing this usefull contents

  • @GreenfieldOTTYS14
    @GreenfieldOTTYS14 2 ปีที่แล้ว

    amazing, thank you so much!

  • @Elekks
    @Elekks ปีที่แล้ว +3

    Consider maybe moving you're camera to the top right of the screen. Around 26:27ish you were blocking the syntax for less than and greater than operators. Not a huge deal but could make the video easier to follow.

  • @leonWischmeyer
    @leonWischmeyer 2 ปีที่แล้ว

    Pls make your cam in the top right corner and make it a bit smaler. The tutorial is very nice. When you have experience with flask fastapi is very easy to learn.

  • @arturmostowiak9427
    @arturmostowiak9427 2 ปีที่แล้ว +3

    The PUT method is not necessarily a method that updates something. For this you have PATCH method. PUT is in short : create a resource or update it if it exists.

  • @Latif127
    @Latif127 6 หลายเดือนก่อน

    It is a nice tutorial. Thank you

  • @wakweikafelix
    @wakweikafelix ปีที่แล้ว

    Thank you for sharing!

  • @shashankm4363
    @shashankm4363 3 ปีที่แล้ว

    YES... New video from tim!!!!!!

  • @gnvageesh6467
    @gnvageesh6467 3 ปีที่แล้ว +23

    That's cool and easy for those who have experience with Flask... Could make a tutorial on Python and Firebase like a backend tutorial

    • @mike_vahemoubayed8099
      @mike_vahemoubayed8099 3 ปีที่แล้ว +1

      That would be awesome, I never used firebase, that would be nice to learn

    • @gnvageesh6467
      @gnvageesh6467 3 ปีที่แล้ว

      @@mike_vahemoubayed8099 yes...

  • @rahulkmail
    @rahulkmail 3 ปีที่แล้ว

    Excellent tutorial

  • @islamh6042
    @islamh6042 11 หลายเดือนก่อน

    Thanks Tim!

  • @iho2437
    @iho2437 2 ปีที่แล้ว

    Based Tim with the API knowledge.

  • @sakethgupta2885
    @sakethgupta2885 3 ปีที่แล้ว

    Make a tutorial on media pipe which helps us a lot in object recognition, and boosts the capability of opencv

  • @jeroenvermunt3372
    @jeroenvermunt3372 2 ปีที่แล้ว +1

    Could you do a quick little tutorial on how to connect this with a persistent database

  • @eldaria
    @eldaria 2 ปีที่แล้ว

    Nice, this was very helpful. But as someone else also said, there were a few times that your facecam blocked what you were typing.

  • @tcgvsocg1458
    @tcgvsocg1458 2 ปีที่แล้ว

    Well its time to click a like bouton on all video and...tyx a lot for all you video

  • @AtulKumar-zu5hx
    @AtulKumar-zu5hx ปีที่แล้ว

    great explanation

  • @ashraf736
    @ashraf736 2 ปีที่แล้ว

    Nice explanation

  • @umynchannel7528
    @umynchannel7528 2 ปีที่แล้ว

    thank's for providing a lot of information to us, but can you make a video on django rest api.

  • @user-re1vj1jx4r
    @user-re1vj1jx4r ปีที่แล้ว

    Great one!

  • @ChrisHalden007
    @ChrisHalden007 ปีที่แล้ว

    Great video. Thanks

  • @jorgeholguin2009
    @jorgeholguin2009 7 หลายเดือนก่อน

    I am running this examples on IDLE shell 3.10.2 and it always get this error: ModuleNotFoundError: No module named 'fastapi'. could you tell me what is wrong?. Thanks in advance

  • @drewprof
    @drewprof 2 ปีที่แล้ว

    Good vid Tim!

  • @anshuman4mrkl
    @anshuman4mrkl 3 ปีที่แล้ว

    Clearly explained

  • @gustavo8433
    @gustavo8433 ปีที่แล้ว

    Thanks for the tutorial !! I need to put some dash/ plotly elements into my API. is it possible ? how could this be done ?

  • @johnnyt.2523
    @johnnyt.2523 3 ปีที่แล้ว +1

    Outrageous! xD

  • @gustavojuantorena
    @gustavojuantorena 3 ปีที่แล้ว

    Great content ! Thank you

  • @lucastavares7767
    @lucastavares7767 2 ปีที่แล้ว

    Very Good, from Brazil 🇧🇷😃👍

  • @Wonderfull_Hasti
    @Wonderfull_Hasti 11 หลายเดือนก่อน

    Thank you very much for this video. Just it would be nice if you add to name of video "+Swagger_UI". As I searched a lot for that and I found that it is included in this tutorial although you did not mentioned it! :)

  • @GelsYT
    @GelsYT ปีที่แล้ว

    THANK YOU!!!

  • @bjorncalbes7604
    @bjorncalbes7604 2 ปีที่แล้ว

    waiting on a video where you use fast api to create a project 👊

  • @gianniprocida3332
    @gianniprocida3332 2 ปีที่แล้ว

    Excellent!

  • @liorbm1
    @liorbm1 2 ปีที่แล้ว

    Its just weird to learn from someone that is under 18.. LOL
    Love your channel..

  • @opcon3155
    @opcon3155 2 ปีที่แล้ว +3

    Just so you know, Django rest framework also has very strict validation capabilities