Flask Tutorial #4 - HTTP Methods (GET/POST) & Retrieving Form Data

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

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

  • @asyaevloeva1270
    @asyaevloeva1270 4 года назад +90

    omg this is such a great tutorial!! i wasted 2 days trying to make my post/get methods work and was about to give up haha but fortunately i found this video! thank you for such a clear explanation!!!

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

      I have also wasted 2 days. Hope this tutorial will give with i want.

    • @ko-Daegu
      @ko-Daegu 3 года назад +5

      For people in future check out
      Flask CS50
      The explanation is phenomenal

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

      why are you subscribed to andyjaide?

  • @Brianccards
    @Brianccards Год назад +6

    Unbelievably helpful. Watched a few of these videos and I feel like I learned a ridiculous amount in just one day. Went from 0 knowledge of HTML and flask with basic python to feeling like I can make any website lol

  • @longkesh1971
    @longkesh1971 Год назад +8

    Exactly what I needed for an example of how to use an HTML form with flask. I really appreciate how you provide a simple example and keep it to around 10 minutes. Thanks man, I'm trying to do my college homework for Python class and this was great.

  • @anirvinvaddiyar7671
    @anirvinvaddiyar7671 3 года назад +49

    I just watched this video 3 times to figure out that my post method wasnt working because I put "methods" in the html form attribute instead of "method".....i love coding so much

  • @haozhe3237
    @haozhe3237 4 года назад +18

    The clearest video on this topic I have seen so far. Thank you so much Tim. Really helpful and understandable for us absolute beginners.

  • @Astr0B
    @Astr0B 5 лет назад +1

    This guy is a sick lad. Does't worry about or-complicated explanations and just gets straight to the point

  • @holycowss
    @holycowss 3 года назад +15

    Your videos are very user-friendly and easy to follow along with! You have helped me more than I could say! Thanks for all your hard work and dedication!

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

    I really wanna move onto the next video but I had to stop and comment and say how great these videos are. This is EXACTLY what I've been looking for! Thank you SO much!
    I'll be watching the videos in order, but hopefully you have a video the covers how to upload file to the server I can run functions on. If not maybe, you can make a video. It's something I've been stuck on for a while now. Thanks!!!

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

    You saved me after 9 hours of coding your the best thank you thank you thank you

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

    You don't know it but you're becoming my hero !

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

    thanks! I was stuck all afternoon trying to connect a form and I solved it right away with your video.

  • @imadoulhou7854
    @imadoulhou7854 5 лет назад +20

    much appreciate Tim! hope to see deep and advanced tutorials about Flask..

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

    This video is great. I am a SQL developer, so python and HTML are a side gig for me. I was struggling with taking in input from a flask server and passing it to other functions but you have explained everything in a way that is both easy to understand and is translatable to my application's needs. Thanks so much!!!!

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

    I am very glad that you have created these videos on this topic. this just saved me from failing a class.

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

    Love how you give context to the content and what you're doing, great tutorial!

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

    Very helpful video for figuring out how to use Get and Post requests with Flask. Thank you very much.

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

    I did this because yes.
    I put some pride into my work and merged the RENDER_TEMPLATE function with a dictionary called CONTENTS that is basically configuration.
    Here is script Number 1
    from flask import Flask, redirect, url_for, render_template
    from settings import contents
    def rendertemplate(name):
    return render_template(name, contents=contents)
    Here is script Number 2
    contents = {
    "forListTest":["This", "is", "a", "test."],
    "title":"Trebla2"
    }
    Please note that this is super early on, so some of this is probably gonna change when i finish.

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

    Brief and brilliant explanation.

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

    Great material and finally I learnt to develop a web application!

  • @mehulrana9485
    @mehulrana9485 4 года назад +5

    This is really helpful. Thanks Tim, very clearly explained.

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

    dude thanks so much, i wanted to know how to make buttons for my webpage and now it works thanks man

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

    Thanks bro u r da best Tim. I really appreciate this because i have advanced alot

  • @carecavoador
    @carecavoador 5 лет назад +21

    Hey, Tim. Would you mind showing us what packages have you installed on your Sublime Text?

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

    Thank you so much, You saved my life. I hope your channel grow more & more

  • @JohnLoydMadrinian
    @JohnLoydMadrinian 9 месяцев назад

    salamat dok sa inyo
    salamat sa pagtulong niyo
    pag-aalaga ay tapat at totoo
    maayos na kalusugan
    buong hangad kanino man
    sa bawat pilipino'y kayo ang takbuhan
    kaya't salamat dok
    sa pagtulong na lubos
    kalusugan namin naging maayos
    salamat dok sa inyo
    nakagabay lagi kayo
    impormasyong hatid laan sa bawat tao
    salamat dok sa inyo
    salamat sa pagtulong niyo
    pag-aalaga ay tapat at totoo
    maayos na kalusugan
    buong hangad kanino man
    sa bawat pilipino'y kayo ang takbuhan
    salamat dok (5x)

  • @mouadtaoussi42
    @mouadtaoussi42 5 лет назад

    Best Instructor Ever !!

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

    There goes my hero. Watch him as he goes!

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

    this is exactly what I needed.

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

    Please Tim IOT toturials plz .I trully really like and follow your Tutorials

  • @Dan-codes
    @Dan-codes 3 года назад

    This saves tons of time, thank you.

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

    Thanks buddy. The videos were really helpful. To the point and informative as hell.

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

    unbelievebly understandable, congrats!

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

    Thank you so much, very helpful.

  • @caliapster8720
    @caliapster8720 5 лет назад +2

    ty *Tim sorry for saying your name wrong last time.
    I really appreciate these series.

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

    The key difference between GET and POST - GET doesn't have request body. That's why POST is secure - you can send encrypted data .

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

    Thank you, Really appreciate your work..!

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

    this is an excellent series, thank you Tim

  • @JW-nr3zo
    @JW-nr3zo 3 года назад

    this is so good. great work! bless your day

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

    Simple and Clear. Thanks a Lot

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

    Very clear, thank you.

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

    God bless you bro ❤

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

    Thank you very much for this video! It was very educational for me :)

  • @PeranMe
    @PeranMe 5 лет назад +2

    Great stuff, as usual! Thanks for sharing this! Any plans on discussing security, like input sanitization etc?

  • @compton8301
    @compton8301 5 лет назад +6

    Tim, could you please make a Udemy course. I love your fantastic teaching style. Udemy makes it easier for us "third world" student to afford quality content.
    Much appreciation from South Africa! ™️💯

  • @JacMaciag
    @JacMaciag 5 лет назад

    Cool, thx for this. I was working on a Flask app recently and this, I hope, will validate I did something good :) Waiting for more episodes.

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

    Fantastic lesson, you helped me a lot. Thank you so much!

  • @barungh
    @barungh 5 лет назад

    Waiting for next video impatiently ...

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

    Thank you for this awesome tutorial!

  • @marcin_lewandowski
    @marcin_lewandowski 11 месяцев назад

    Thanks a lot Tim

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

    Appreciate your work keep it up!

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

    best video tutorial

  • @unchart_d
    @unchart_d 5 лет назад +1

    Thank you brother for this tutorial.

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

    Amazing tutorial

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

    absolute legend ty so much!!!

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

    what a legend, very helpful

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

    Thanks for your lessons!

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

    so clear. thx , Tim.

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

    Thanks for the great video Tim. Can you please explain how we can get more than one value in the login route if the form has more input tags?

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

      have you found the solution to pass 2 values?

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

      found a way to resolve this..
      You have to parse the multiple parameters with the url (using javascript redirect option).. then when it has been redirected to your app route, then
      var 1 = request.args.get('your_param_name1')
      rvar 2 = equest.args.get('your_param_name2')

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

    Hey Tim your video has been a great help to me but can you tell me how can I show the output on same page below my form when I click the button.

  • @MusicGameFinatic999
    @MusicGameFinatic999 4 года назад +8

    WARNING FOR BEGINNERS, MISTAKE AT THE BEGINNING OF THE VIDEO: a POST request is NOT more secure than a GET request.
    The information being sent in a POST request is hidden from the URL, and that is all. Anyone wanting to intercept the data being sent across the network could easily do so.
    While it is true that POST doesn't expose information via the URL, it exposes just as much information as a GET in the actual network communication between the client and server. If you need to pass information that is sensitive, your first line of defense would be to pass it using Secure HTTP.
    Not trying to knock your video Tim, just wanted to make sure that new user's don't try to send passwords and other sensitive data across the network using only a POST request.

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

      No worries! Thank you for pointing that out as a few others have as well. This was a critical mistake on my part as I did not define what I meant by secure. I will be the first to admit when I make a mistake and this was a big one! Thankfully we have people like you who can point them out

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

      @@TechWithTim Hi Tim - maybe you should make a little text overlay on that part of the video to explain since many people might dig through the comments. BTW, your tutorials kick serious a$$

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

    Thank you so much for the videos learning a lot...:)
    lol @6:13

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

    usefull and complete thank you

  • @sanicspeed1672
    @sanicspeed1672 9 месяцев назад

    If youre having trouble with errors check task manager and see if there arw any python files running in background

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

    HI, Instead of printing all the columns in GET request, How could I get only specific columns from the postgres table?

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

    What is the purpose of "/" before the closing tags?

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

      input is a self closeing tag

    • @_b0mbix_
      @_b0mbix_ 4 года назад +4

      I heard that isn't necessary (HTML works with and without "/"). However, if u want to have page compatibile with XHTML, u need all closing (/) tags, even in sth like input, br and img

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

      @@_b0mbix_ thanks

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

    How would you go about adding posts/blogs?

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

    Thanks for sharing

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

    I dont get it why do you have also and base.html and index.html, can you show them and what is difference between this 2, great video, but I am confused with 3 html files insed of 2

  • @maximdongur-ool2226
    @maximdongur-ool2226 4 года назад

    guys! its important. When you copy Navbar, CSS and JS you have to use version Bootstrap v4.3. Now at 2020 October its v 4.5
    new version makes lots of problem when you try Login with method POST

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

    7:27 It seems you still get POST when you refresh it?

    • @Ahmed-bb4yp
      @Ahmed-bb4yp 4 года назад +3

      @@MuffinologyTrainer dude shut up and be grateful. You wanna pay $400 for a shitty udemy course? Go ahead. Nobody wants you to just complain and discredit the guy for his work.

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

      If you watch closely, you'll notice that Tim was explaining things correctly. His mistake was due to an honest error. When re-posting, he merely went too fast and didn't change the URL. Be nice. I commend him and anyone who gives of themselves. No need for the rudeness and crass comments/language.

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

      It seems the browser re-did the last action which was a POST. If Tim did tape enter in the url bar, he would have get a GET method.
      Don't know if I'm clear, english is not my native linguage... :/

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

      Hang, browsers repeat the last request they sent when they are asked to refresh a page. When the last request sent is a POST, when you refresh you get a POST again. A refresh would cause a duplicate form submission, which in almost all cases is not the desired action. For that reason, the browser asks for confirmation from the user (browser-pop-up message shown in the video).
      Many users do not understand this warning from the browser. Consequently, it is considered good practice for web applications to never leave a POST request as the last request sent by the browser. This is achieved by responding to POST requests with a redirect instead of a normal response.
      All these info comes from Miguel Grinberg's Flask Manual.
      I think your question was pretty clever and you didn't mean to "complain" or "discredit" Tim, whom by the way rocks at teaching. Have a good day!

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

    I think that it is a kind of bad practice using "/" URL. What if your username will be equal to "login"?
    The better way is to use URL like "/user/" which will never collide with "/login" or any other pages we would have in the website root.

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

    Great video. My doubt is that I need to send a value selected from a drop down as a GET parameter to my Flask backend. How do I do that? Here you used the function request.form[id] but I need to pass a variable (or parameter) which I would select from a dropdown list.

  • @agentkoko3988
    @agentkoko3988 5 лет назад +2

    Hey Tim, Please continue that PYTHON to APK file Series ....Show us the method to convert KIVY project to APK

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

    Thanks Tim!

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

    Does anyone else not know wtf Tim was doing from 4:28 to 5:08?

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

    Dear bro
    Tnx for your video .
    I need to know how i can appear the captcha code in busy or overloaded sites when tis not shown captcha code ( just show the image box instead off captcha code) by get and post method.

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

    Hi! Awesome!
    What would you recommend for hosting of the simple site writing in python?

  • @zt.5677
    @zt.5677 3 года назад

    Interestingly, I have left the re-route function from the previous video in the code and the POST, GET function re-route uses that one instead of the one I have created for it. Wonder why?

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

    This gives me error as "The method is not allowed for the requested URL." even if i wrote exactly the same code.

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

    My file directory is Flask_tutorials/tutotrial.py templates/login.html base. Html index. Html but I still keep getting jinja2 exceptions

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

    Thanks It worked

  • @channelname437
    @channelname437 5 лет назад

    Thanks for the video Tim. Can you recommend a book about web development?

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

    If you are getting the error 405 Method not allowed use the line methods = ["GET","POST"] on the @app.route wrapper seperated by a comma next to the subpage
    like so app.route("/login",methods=["GET","POST"])
    fixed the problem for me

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

    Good video! I thinking how to get that data from input and just print it in console (other purpose, than generating page - for example just adding something to db), I tried but without success. Maybe is super-easy and I am just to tired ..

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

    Hey Tim can you make a tutorial for how to conect html,css,js with FLAK, and we should also be able to send and receive data in the json format, and I hope you use axios, or else you can use jquery and ajax.

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

    Ok, wow, after a lot of struggle I was able to make this work. Phew! But I was actually trying something way more advanced, to obtain the inputs from drop down lists and print them on the screen. Tim, is it possible to print the value in the same main page? Right now in order to display the values I am needing to go to a new Url, which doesn't make sense. I want to display the values in the same page as the drop down menus (there are various of them).

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

    If we on vsc will we choose pyton Or html for working?

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

    7:09, after I login it comes with this error:werkzeug.routing.BuildError: Could not build url for endpoint 'harshi' with values ['usr']. Did you mean 'static' instead?
    plz help thanks

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

      try doing the tutorial again, it's great as its only a 10-minute video, I don't know if over the past week you've resolved that problem but I'm 9 minutes in and I have no problems

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

      @@safwanakhtar2528 Yes thank you I resolved it, it was a silly mistake

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

      @@minecraft4life688 bro what was the mistake I am getting same problem

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

      @@tradingwithsujay for the redirect I put redirect to the user page but I put just put user, you have to put user in quotation marks because that's the page

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

      Atleast that was the mistake for me

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

    Can I have the server st a different domain than the front end ? How would i communicate? Via js request

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

    07:34 Determine POST and GET in login function

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

    Thanks.

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

    Thanks

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

    If we need to transmit large data through a redirect, how can we do that? I encountered an 'ERR_RESPONSE_HEADERS_TOO_BIG' error when attempting to pass the data.

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

    Awesome !!!

  • @Ninniet-zt2tc
    @Ninniet-zt2tc 2 года назад

    MAN U HELPED ME SO FKING MUCH THXXX

  • @nikh9852
    @nikh9852 5 лет назад

    Hi Sir, pls make a video on Flask with Microsoft SQL Server Connection, Get Data and Display on web , Show MSSQL TABLE DATA AS GRIDVIEW ON WEBPAGE

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

    Is this tutorial or a skill show?

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

    For my 405 issue I had to change the html code to

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

    Thanks bro!!

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

    I would like to ask to you if there is a chance that you will show up how to cooperate with sqlite and flask together. Thanks for watching this.