Create A Python API in 12 Minutes

Поділитися
Вставка
  • Опубліковано 27 тра 2024
  • Rapidly build and deploy APIs in seconds with DreamFactory ! bit.ly/3M1TAP7
    Are you learning programming and wondering what an API is? An API is an Application Programming Interface that allows different software or systems to communicate with one another. I'll show you how to whip up your very own API in just 10 minutes using Python and Flask.
    Post Man API Platform:
    www.postman.com/
    Fix Pip (Windows):
    • How to Install Pygame ...
    Fix Pip (Mac):
    • How to Install Pygame ...
    💻 Master Blockchain and Web 3.0 development today by using BlockchainExpert: 🔗 algoexpert.io/blockchain (Use code "tim" for a discount!)
    💻 Accelerate your software engineering career with ProgrammingExpert: 🔗 programmingexpert.io/tim (Use code "tim" for a discount!)
    🎬 Timestamps⏱️
    00:00 | What is an API?
    02:02 | Dependency Setup
    02:49 | Flask API Setup
    04:49 | HTTP Methods
    05:28 | GET Routes
    08:46 | POST Routes
    10:38 | Testing APIs
    11:42 | Next Steps
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    👕 Merchandise: 🔗 teespring.com/stores/tech-wit...
    📸 Instagram: 🔗 / tech_with_tim
    📱 Twitter: 🔗 / techwithtimm
    🔊 Discord: 🔗 / discord
    📝 LinkedIn: 🔗 / tim-ruscica-82631b179
    🌎 Website: 🔗 techwithtim.net
    📂 GitHub: 🔗 github.com/techwithtim
    One-Time Donations: 💲 www.paypal.com/donate?hosted_...
    Patreon: 💲 / techwithtim
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    ⭐️ Tags ⭐️
    -Tech With Tim
    -Python
    -Programming
    ⭐️ Hashtags ⭐️
    #techwithtim #python #coding

КОМЕНТАРІ • 150

  • @TechWithTim
    @TechWithTim  Рік тому +19

    Rapidly build and deploy APIs in seconds with DreamFactory ! bit.ly/3M1TAP7

    • @blisterj
      @blisterj Місяць тому

      not another monthly subscription app

  • @ban-prem-001
    @ban-prem-001 Рік тому +94

    next video should be on how to deploy the sites, especially using free services like pythonanywhere

  • @scrung
    @scrung 11 місяців тому +19

    An API is just an interface of callable functions. It can be a code library that simplifies some complex tasks, a web API (which is what this video talks about) or a bunch of functions that a running process on your computer exposes for other programs to interact with

  • @hitmanLis
    @hitmanLis 2 місяці тому +4

    just love that you get to point fast and cover just enough details to get people going! Bravo!

  • @josecintron85
    @josecintron85 Рік тому +6

    great video, explain the concept in a simple manner, no fuzz, no-frills. I wish a video like this existed when I created my first API a couple of years ago.

  • @user-rz7fj2le2i
    @user-rz7fj2le2i Рік тому +71

    This definition of API is completely in the context of web development. There are lots of non web based APIs provided by python packages for things like machine learning, scientific computing etc. and distinguishing between the two at the start of the video would be helpful for people from non web based backgrounds.

    • @TechWithTim
      @TechWithTim  Рік тому +33

      Actually that’s a good point, an oversight from me, thanks for the feedback!

    • @jaylooppworld381
      @jaylooppworld381 Рік тому +1

      i was about to say the same. The video is great but not usefull for all purposes

    • @cuongbang7721
      @cuongbang7721 10 місяців тому +4

      Yeah, more like "REST API" 🙂

    • @God0f0dd
      @God0f0dd 10 місяців тому

      I was wondering the same thing… the notion of an API in computer science predates the internet by many, many years. All that low level stuff the browser is doing so users can run web apps? Yeah, generally exposed through platform API. 😊

  • @DreamfactorySoftware
    @DreamfactorySoftware Рік тому +5

    Thanks for featuring DreamFactory in this video! Keep up the great work! 👍😊

  • @ismailibrahim879
    @ismailibrahim879 Рік тому +27

    thank you for being a huge part of the tech industry.. we appreciate you.

  • @cody_codes_youtube
    @cody_codes_youtube Рік тому +16

    This was such a great explanation of an API. Great editing too! Well done

  • @nyosgomboc2392
    @nyosgomboc2392 Рік тому +3

    Nice, simple, and right-to-the-point tutorial.

  • @loveafinni
    @loveafinni 6 днів тому

    Very great start to building APIs with Python. Thanks Tim!

  • @HDArtzy
    @HDArtzy 10 місяців тому +1

    sweet video dude,, you've honestly been helping me for like 4 years at least now with Python tutorials and school. I want to start getting into the field now but I dont know how to start. Thank you for your guides

  • @JorgeEscobarMX
    @JorgeEscobarMX 9 місяців тому

    Ohhhh Iwatched it already, I'm giving a rewatch to it and look for a flask course. I can think of making my python scripts accessible from the web. Thats a super power.

  • @farid5347
    @farid5347 10 місяців тому

    Thank you so much Tim for your lessons! You helped me a lot to know more about Python amenities

  • @SaschaJanetschek
    @SaschaJanetschek 8 місяців тому

    No idea what you did there, since it's my first time using Flask, but it works. Thank you

  • @ambikeya_tech
    @ambikeya_tech 27 днів тому

    Fantastic tutorial! Concise yet comprehensive. Appreciate the step-by-step approach. Simplifies Python API creation. Thank you for sharing your expertise!

  • @user-re8nw9wk4n
    @user-re8nw9wk4n 10 місяців тому +11

    Great presenter for every level learner! Your kind of tech people are rare. You are not only a outstanding performer in your profession but also a great presenter well organized and 100% clarity.

    • @TechWithTim
      @TechWithTim  10 місяців тому +3

      Appreciate that so much!

  • @panic_seller
    @panic_seller Рік тому +1

    6 Years experience in every aspect computing and technology but somehow I never came across API development, very interesting. I've just been calling and calling them but never writing them

  • @phillip.dustin
    @phillip.dustin Рік тому

    Very timely video! Thank you!

  • @alimihakeem841
    @alimihakeem841 Рік тому

    Nice one Tim.. Thanks for sharing this great and wonderful content.. Hoping to see more beneficial videos on flask.

  • @sasakanjuh7660
    @sasakanjuh7660 Рік тому +55

    Nice video, as always, though I'd just suggest making a virtual environment (I know you know this, but the people watching/following the tutorial might not), especially since you're using python, so it's super easy :)

  • @yerneroneroipas8668
    @yerneroneroipas8668 Рік тому +1

    Great tutorial, followed along and it was easy to understand. I guess a great follow up would be a video explaining how to use this with a real example.

  • @GTV_367
    @GTV_367 10 місяців тому

    You are a very good teacher I learn better from your ch.thanks🤞🏽

  • @manofculture9915
    @manofculture9915 Рік тому

    I needed this vid, Thank you

  • @derrickk45
    @derrickk45 6 днів тому

    So clear.. thanks

  • @BonVoyageWorld
    @BonVoyageWorld 11 місяців тому

    Great video like always Tim 👍🏽🍷

  • @sohamshah4666
    @sohamshah4666 Рік тому

    I was just thinking i will be need like this content .....and at same time you posted what a great time thanks for this tim very helpful .....i am working on projects flask

  • @360withpaul
    @360withpaul 10 місяців тому

    Thank you very much for sharing, very interesting topic! Keep it up 🔥

  • @REgamesplayer
    @REgamesplayer 9 місяців тому +6

    GET routes part is wrong. I get 404 error despite seemingly having identical code. What is unsaid in this part is that you need to type this address. It is quite confusing at first where in the code this get-user 123?extra="hello" is referenced and why base link which your server gives you suddenly stops working.

    • @IanWeingardt
      @IanWeingardt 4 місяці тому

      I have the exact same problem, I'm scrolling through the comments for awnsers.

  • @yousifahmed257
    @yousifahmed257 8 місяців тому

    Thank you so much. I like yours tutorials

  • @arpitkumar4525
    @arpitkumar4525 3 місяці тому

    Simple and to the point

  • @learnhumanity6701
    @learnhumanity6701 2 місяці тому

    Awesome Explanation❤

  • @jeromesimms
    @jeromesimms 8 місяців тому +5

    Hey Tim, in this video you looked at creating APIs with Flask and the way it is done is mostly with functions and decorators but at the end of the video there was a recommendation to your full Flask API video. When I watched the full Flask API video it seemed to be using class based views, or just a completely different style to what is showed in the video. So could you make a new updated longer form tutorial on using Flask for creating APIs and in it could you discuss about whether to use classes or functions with annotations and if we should use one when we should. Thanks for this vid because I was really happy to learn how to get a simple API up and running with Python.

    • @chisomedoka5651
      @chisomedoka5651 7 днів тому

      I watched that video first and I was so confused before coming here

  • @TdukeTduke
    @TdukeTduke 6 місяців тому +2

    The delivery of the information was very clear, but I had difficulty understanding the "why" behind a lot of things you did in the video.

  • @jannisheider5340
    @jannisheider5340 2 місяці тому

    Thanks, its a really good Video for starting with API 👍👍👍👍

  • @nehaagrawal7850
    @nehaagrawal7850 9 місяців тому

    Great information. Thanks for sharing . How can we increase timeout for the api here as the default timeout is 1 minute ?

  • @hinahammad1047
    @hinahammad1047 4 місяці тому +1

    Bro really taught web development in python in 12 minutes

  • @pungushe
    @pungushe 11 місяців тому

    Thank you so much for this video

  • @HopeMichaels
    @HopeMichaels Рік тому

    i've recently watched your UA-cam video on why random generated numbers are not really random. I have a case that i've been working on figuring out. There is a Game that produces decimal generated numbers randomly and the play is for you to predict the next number that it will generate like it gives out 2.92, 1.65, 1.04, 3.75, 6.73, 1.53 ...... it may even reach 10000.0 some times. Is there a way that i can use those previous generated numbers to predict the next numbers that it will generate?

  • @AwesomeRandomVids
    @AwesomeRandomVids 6 місяців тому +3

    At 8:33, I'm getting a 404 error. My url stops at :5000 and doesn't list 'get-user' etc. I went through the code letter by letter and can't find what I might be missing. Anyone have any ideas?

    • @awesomegirl5315
      @awesomegirl5315 5 місяців тому +2

      I think you have to put in /get-user/123?extra="hello" in the url manually and then it works. I had the same issue.

    • @AwesomeRandomVids
      @AwesomeRandomVids 5 місяців тому

      @@awesomegirl5315 I'll give that a try, but doesn't that defeat the purpose of the code? Shouldn't it do that for you? Sorry if I sound ignorant. I am

    • @IanWeingardt
      @IanWeingardt 4 місяці тому

      Same problem...

  • @donewithwork
    @donewithwork Рік тому

    Another great video :)

  • @carloseduardodesouza9245
    @carloseduardodesouza9245 11 місяців тому

    vary good video... Thanks

  • @VasilijMaksimov
    @VasilijMaksimov Рік тому

    Спасибо за понятное изложение материала

  • @dr.dark.flames
    @dr.dark.flames Рік тому +1

    Damn i remember when u had 20k. Time flies

  • @warloccarlos8522
    @warloccarlos8522 Рік тому

    Hi @TechWithTim Please recommend a SAST & DAST tool specifically for Python based web application. I am aware that for web application we can use any available tool, however I am curious for only Flask and Django based web application.

  • @JohnMichaelCagle12
    @JohnMichaelCagle12 9 місяців тому

    Great video!

  • @techcolor2106
    @techcolor2106 5 місяців тому

    Thank you sir!

  • @FRANKODE
    @FRANKODE Рік тому +1

    Which video editor do you use

  • @luisvillar8320
    @luisvillar8320 9 місяців тому

    Great video, just the right amount of information at the right pace, and the name should be changed to say "in 10 Minutes".

  • @Akgaming-games
    @Akgaming-games 8 місяців тому

    Hi, Can requests be used to test and not postman??

  • @getreadytotube
    @getreadytotube 7 місяців тому

    Thanks!

  • @user-tj4qf2zc3b
    @user-tj4qf2zc3b 11 місяців тому

    Thanks so much

  • @memoriesxt
    @memoriesxt Рік тому +1

    Would to do a REST API for python too?

  • @stuartmould2694
    @stuartmould2694 11 місяців тому +1

    Great vid thanks. I think you might have missed some info if you can confirm. When you demo the GET request you're using the id:123, however we don't set that up so we can't repeat the steps as you have as you have presumably already created a user in this scenario?

  • @centralcoding
    @centralcoding 9 місяців тому

    Brother Tim, do you have this course with Django please???

  • @martinn1071
    @martinn1071 8 місяців тому

    thanks so much. brilliat

  • @FranciscoIgnisci
    @FranciscoIgnisci 9 місяців тому

    Someone would tell me the configuration of the font?? I loved it

  • @Snowfon
    @Snowfon 6 місяців тому

    What keyboard do you have?

  • @arsiarskila
    @arsiarskila Рік тому

    Hi, what would the html code look like?

  • @Hiturion
    @Hiturion 5 місяців тому

    just a note: when you call the api in the url, you do not need to put "extra" between quotes. ;)

  • @FricoSimon-li6hd
    @FricoSimon-li6hd 2 місяці тому

    great vid

  • @timbrap4693
    @timbrap4693 Рік тому +3

    Why not use FastAPI?

  • @ojedachristian1970
    @ojedachristian1970 Місяць тому

    Hi, I need to create an api with python to modify the banner of different servers and host, does someone have an idea about how to develop this api for a practice?
    This is new for me

  • @himanshunanda1994
    @himanshunanda1994 11 місяців тому

    not able to install flask tried changing the virtual environment as well
    someone if faced the same issue please help

  • @GoodBoyDanny
    @GoodBoyDanny Рік тому +1

    This is cool, what's the price?

  • @prateeksinha08
    @prateeksinha08 Місяць тому +1

    Is there any way to change the name of C:\Users\Tim to C:\Users\Prateek, I have this problem in my laptop where it's name is 91700 and I wanna change it to prateek(my actual name)

  • @Boghost1430
    @Boghost1430 9 місяців тому

    How do you install libraries without needing a venv

  • @JorgeEscobarMX
    @JorgeEscobarMX 9 місяців тому

    wow, this is way easier than nodejs with expressjs.

  • @damilolaasepo1165
    @damilolaasepo1165 11 місяців тому +2

    i tried the get part and got an error :
    The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

  • @GlitchyGlobe
    @GlitchyGlobe 6 місяців тому

    Cam someone explain m3 why do we do that?

  • @hhhhhhhhhhhhhhhhh159
    @hhhhhhhhhhhhhhhhh159 Рік тому

    And why dont you implement rest into it?

  • @TimeToGG
    @TimeToGG Рік тому

    Nice.

  • @jokereenoo7025
    @jokereenoo7025 Рік тому

    Hero❤❤❤

  • @user-yp3ik9rx5c
    @user-yp3ik9rx5c 10 місяців тому

    Make a tutorial on Falcon microframework

  • @muborak_oy_suhbatlari
    @muborak_oy_suhbatlari 5 місяців тому

    how to open dream factory admin page?

  • @ARSNAL794
    @ARSNAL794 Рік тому

    Lean on

  • @amirmirzababapour6016
    @amirmirzababapour6016 11 місяців тому

    nice video and the beard suits you well.

  • @TheBeast-lu9qm
    @TheBeast-lu9qm Рік тому

    you got old but stil very good

  • @Kirkrrr
    @Kirkrrr 3 місяці тому +24

    I'm a bit confused by who this video is supposed to be for. Experienced developers? Because the information conveyed is presented at such a fast pace and with so little explanation, it's clearly not for people who aren't familiar with most of what's discussed already. I'll rewatch it another dozen times and hopefully it'll sink in, but this can't be described as "well explained."

    • @user-ki8si8ro6f
      @user-ki8si8ro6f 2 місяці тому +2

      im having the same problem, the video is very informative but also very fast paced, i reduced the playback speed to better grasp whats happening in the video

    • @Hacker_Baby
      @Hacker_Baby 2 місяці тому

      I would recommend going through and doing a primer course on Python prior to this, just so you have a better understanding of some of the more advanced topics such as the function decorators that flask uses to create routes. Once you do that, this video will make a lot more sense, and you won’t feel so intimidated lol

    • @Notepad123
      @Notepad123 29 днів тому +2

      All of his videos are fast paced

    • @lederpium1965
      @lederpium1965 25 днів тому

      the video was good for me i think u need to probably work on the basics a bit more and maybe itll get easier to understad

    • @lutaayajamil5476
      @lutaayajamil5476 8 днів тому +1

      It is a good video but as you said, it is not fit for beginners. It is nice if you already knew what an API is and how to build one in other tools.

  • @user-ki8si8ro6f
    @user-ki8si8ro6f 2 місяці тому

    great video but i had to slow it down to .75 playback to keep up with what you were saying/doing, could you please slow it down for us beginners, as the info is valuable but i have to playback every 10 seconds

  • @thelifehackerpro9943
    @thelifehackerpro9943 11 місяців тому

    Use fast api and create apis even faster

  • @PA-bu5cs
    @PA-bu5cs 4 місяці тому +1

    Your amazing - But why do you need to have som much speed in your tutorials ? I might be the only one thinking it would be nicer to have a slower rytm...

    • @user-ki8si8ro6f
      @user-ki8si8ro6f 2 місяці тому

      youre not alone, i had to reduce the playback speed and he was STILL moving lightning fast lol

  • @King_Mambaa
    @King_Mambaa 5 місяців тому

    PLEASE SOMEONE HELP WHAT iS HE USNG iS THAT REPLiT? AND iF SO HOW DO i PULL UP THAT TERMiNAL ALL i HAVE iS SHELL AND SHELL DOESNT LET ME PASTE ANTHiNG

  • @superfliping
    @superfliping 21 день тому

    Whats next, show your skills? New ground level project
    1. CodeCraft Duel: Super Agent Showdown
    2. Pixel Pioneers: Super Agent AI Clash
    3. Digital Duel: LLM Super Agents Battle
    4. Byte Battle Royale: Dueling LLM Agents
    5. AI Code Clash: Super Agent Showdown
    6. CodeCraft Combat: Super Agent Edition
    7. Digital Duel: Super Agent AI Battle
    8. Pixel Pioneers: LLM Super Agent Showdown
    9. Byte Battle Royale: Super Agent AI Combat
    10. AI Code Clash: Dueling Super Agents Edition

  • @tonymen84
    @tonymen84 Рік тому

    have you heard of spacetraders api

  • @rosalcgaivao1546
    @rosalcgaivao1546 5 місяців тому

    Mi o afonso já está a responder as perguntas, estou com dificuldades

  • @wadahkodeofficial5389
    @wadahkodeofficial5389 7 місяців тому

    Cool

  • @Zvend
    @Zvend 10 місяців тому +1

    Im not sure if thats a "my-perspective"-problem, because with Python API i actually thought u re going to teach how to write an API and not a REST APi :S
    if its not a "my-perspective"-problem, could u change the title to Rest API?

  • @jyvben1520
    @jyvben1520 11 місяців тому

    api is not only for database, can be instructing other devices to do something, might not even need a reply.

  • @manojahlawat2881
    @manojahlawat2881 Місяць тому

    way of teaching is very complex

  • @cnelly749
    @cnelly749 Рік тому +5

    Should’ve made this video with FastAPI it’s much better and easier

  • @senzocalvinshinga6532
    @senzocalvinshinga6532 3 місяці тому

    I wish I was this smart

  • @mostafaghobashy2724
    @mostafaghobashy2724 11 місяців тому

    instead of saying "underscore underscore" you can say "dunder" which is double underscore

    • @scrung
      @scrung 11 місяців тому +2

      problem with that is most people dont know what a dunder member is, so if you dont want to confuse the average learner then it’s better to use terms that theyll understand in the meantime

  • @rosalcgaivao1546
    @rosalcgaivao1546 5 місяців тому +1

    Mi consegues ver?

    • @afonsopalmeira6951
      @afonsopalmeira6951 5 місяців тому

      Resposta Q1: def forest_coverage(area_file, coverage_file):
      # Read data from files
      with open(area_file, 'r') as area_file:
      area_lines = area_file.readlines()[1:] # Skip header
      with open(coverage_file, 'r') as coverage_file:
      coverage_lines = coverage_file.readlines()[1:] # Skip header
      # Initialize the dictionary to store the result
      data_dict = {}
      # Process data for each country
      for area_line, coverage_line in zip(area_lines, coverage_lines):
      # Extract data from lines
      area_data = area_line.strip().split('\t')
      coverage_data = coverage_line.strip().split('\t')
      # Extract relevant information
      country_name = area_data[0]
      country_area = float(area_data[1])
      # Extract coverage information for 2009 and 2019
      coverage_2009 = {
      "coverage_percentage": float(coverage_data[1]),
      "coverage": country_area * float(coverage_data[1]) / 100
      }
      coverage_2019 = {
      "coverage_percentage": float(coverage_data[2]),
      "coverage": country_area * float(coverage_data[2]) / 100
      }
      # Calculate growth
      growth = (
      (coverage_2019["coverage"] - coverage_2009["coverage"]) / coverage_2009["coverage"]
      ) * 100 if coverage_2009["coverage"] != 0 else "-"
      # Round growth to 2 decimal places if it's a number
      growth = round(growth, 2) if growth != "-" else growth
      # Create the country entry in the result dictionary
      data_dict[country_name] = {
      "area": country_area,
      2009: coverage_2009,
      2019: coverage_2019,
      "growth": growth
      }
      return data_dict
      # Example usage:
      area_file_path = "surface_area_sq_km.tsv"
      coverage_file_path = "forest_coverage_percent.tsv"
      result_dict = forest_coverage(area_file_path, coverage_file_path)
      print(result_dict)

  • @rameshsilva8212
    @rameshsilva8212 Рік тому

    👍

  • @derrickk45
    @derrickk45 6 днів тому

    🎉

  • @afonsopalmeira6951
    @afonsopalmeira6951 5 місяців тому

    Resposta do 1 chatgpt: vê pelos teus olhos e mudas as coisas, não consigo ver o input o chat faz melhor que eu:
    def forest_coverage(area_file, coverage_file):
    # Read data from files
    with open(area_file, 'r') as area_file:
    area_lines = area_file.readlines()[1:] # Skip header
    with open(coverage_file, 'r') as coverage_file:
    coverage_lines = coverage_file.readlines()[1:] # Skip header
    # Initialize the dictionary to store the result
    data_dict = {}
    # Process data for each country
    for area_line, coverage_line in zip(area_lines, coverage_lines):
    # Extract data from lines
    area_data = area_line.strip().split('\t')
    coverage_data = coverage_line.strip().split('\t')
    # Extract relevant information
    country_name = area_data[0]
    country_area = float(area_data[1])
    # Extract coverage information for 2009 and 2019
    coverage_2009 = {
    "coverage_percentage": float(coverage_data[1]),
    "coverage": country_area * float(coverage_data[1]) / 100
    }
    coverage_2019 = {
    "coverage_percentage": float(coverage_data[2]),
    "coverage": country_area * float(coverage_data[2]) / 100
    }
    # Calculate growth
    growth = (
    (coverage_2019["coverage"] - coverage_2009["coverage"]) / coverage_2009["coverage"]
    ) * 100 if coverage_2009["coverage"] != 0 else "-"
    # Round growth to 2 decimal places if it's a number
    growth = round(growth, 2) if growth != "-" else growth
    # Create the country entry in the result dictionary
    data_dict[country_name] = {
    "area": country_area,
    2009: coverage_2009,
    2019: coverage_2019,
    "growth": growth
    }
    return data_dict
    # Example usage:
    area_file_path = "surface_area_sq_km.tsv"
    coverage_file_path = "forest_coverage_percent.tsv"
    result_dict = forest_coverage(area_file_path, coverage_file_path)
    print(result_dict)

  • @ravikantjain
    @ravikantjain 4 місяці тому

    noice video

  • @Zancb
    @Zancb Рік тому +4

    FYI it's confusing when you pronounce "root" and "route" the same. When you say "create other routes" it sounds like you're saying "create other roots", which, from a web/filesystem perspective, sounds very silly.

  • @nehanthv4238
    @nehanthv4238 3 місяці тому

    3:04