Тёмный

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

Tech With Tim
Подписаться 1,5 млн
Просмотров 455 тыс.
50% 1

In this flask tutorial I show you how to use the HTTP request methods Post and Get. The POST method will allow us to retrieve data from forms on our web page. In later videos we'll get into more advanced topics relating to login sessions and using POST methods to retrieve secure information like passwords.
Text-Based Tutorial: techwithtim.net/tutorials/fla...
Playlist: • Flask Tutorial #1 - Ho...
◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python
tech-with-tim.teachable.com/p...
📸 Instagram: / tech_with_tim
🌎 Website techwithtim.net
📱 Twitter: / techwithtimm
⭐ Discord: / discord
📝 LinkedIn: / tim-rusci. .
📂 GitHub: github.com/techwithtim
🔊 Podcast: anchor.fm/tech-with-tim
💵 One-Time Donations: www.paypal.com/donate/?token=...
💰 Patreon: / techwithtim
◾◾◾◾◾◾
⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡
Tags:
- Tech With Tim
- Python Tutorials
- Flask Tutorial Python
- Python Flask Tutorial
- HTTP Methods Flask
- Flask Post and Get
#Python #Flask

Опубликовано:

 

1 ноя 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 202   
@longkesh1971
@longkesh1971 11 месяцев назад
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 года назад
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
@blazi_0
@blazi_0 3 года назад
lol
@dp8837
@dp8837 Год назад
Dude same 😭
@kushshri05
@kushshri05 Год назад
🤣🤣
@zdenekfic9854
@zdenekfic9854 Год назад
same :DD
@Dhivya_03
@Dhivya_03 2 месяца назад
Same mistake😢. Thanks
@asyaevloeva1270
@asyaevloeva1270 4 года назад
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 года назад
I have also wasted 2 days. Hope this tutorial will give with i want.
@ko-Daegu
@ko-Daegu 3 года назад
For people in future check out Flask CS50 The explanation is phenomenal
@nostalgiccringeallhailchel3881
why are you subscribed to andyjaide?
@haozhe3237
@haozhe3237 4 года назад
The clearest video on this topic I have seen so far. Thank you so much Tim. Really helpful and understandable for us absolute beginners.
@Brianccards
@Brianccards 7 месяцев назад
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
@joshuaarinaitwe8351
@joshuaarinaitwe8351 19 дней назад
Same. am all like isn't this too much.
@jonathanmantello3974
@jonathanmantello3974 Год назад
Love how you give context to the content and what you're doing, great tutorial!
@holycowss
@holycowss 3 года назад
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 года назад
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!!!
@imadoulhou7854
@imadoulhou7854 4 года назад
much appreciate Tim! hope to see deep and advanced tutorials about Flask..
@mehulrana9485
@mehulrana9485 4 года назад
This is really helpful. Thanks Tim, very clearly explained.
@dorianvedel1910
@dorianvedel1910 4 года назад
You don't know it but you're becoming my hero !
@Warclimb64
@Warclimb64 Год назад
thanks! I was stuck all afternoon trying to connect a form and I solved it right away with your video.
@nitinkashyap1821
@nitinkashyap1821 2 года назад
I am very glad that you have created these videos on this topic. this just saved me from failing a class.
@manvelbeaver520
@manvelbeaver520 3 года назад
Very helpful video for figuring out how to use Get and Post requests with Flask. Thank you very much.
@ryanfields1533
@ryanfields1533 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!!!!
@RoryDavidWatts
@RoryDavidWatts 3 года назад
this is an excellent series, thank you Tim
@manasvinsharma1740
@manasvinsharma1740 4 года назад
Brief and brilliant explanation.
@TheGiant225
@TheGiant225 2 года назад
You saved me after 9 hours of coding your the best thank you thank you thank you
@Astr0B
@Astr0B 4 года назад
This guy is a sick lad. Does't worry about or-complicated explanations and just gets straight to the point
@gustavoaurelio1
@gustavoaurelio1 3 года назад
unbelievebly understandable, congrats!
@DailyIntern
@DailyIntern 4 года назад
Thank you brother for this tutorial.
@abhinav9561
@abhinav9561 2 года назад
Thanks buddy. The videos were really helpful. To the point and informative as hell.
@bogdanmind3271
@bogdanmind3271 2 года назад
Fantastic lesson, you helped me a lot. Thank you so much!
@mouadtaoussi42
@mouadtaoussi42 4 года назад
Best Instructor Ever !!
@PeranMe
@PeranMe 4 года назад
Great stuff, as usual! Thanks for sharing this! Any plans on discussing security, like input sanitization etc?
@JacMaciag
@JacMaciag 4 года назад
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.
@sergeichwelcome
@sergeichwelcome 4 года назад
Thanks for your lessons!
@codewithlenny
@codewithlenny 4 года назад
Simple and Clear. Thanks a Lot
@samsmusichub
@samsmusichub 4 года назад
There goes my hero. Watch him as he goes!
@exoticme4760
@exoticme4760 3 года назад
Thank you so much, You saved my life. I hope your channel grow more & more
@Dan-codes
@Dan-codes 2 года назад
This saves tons of time, thank you.
@sanjevsplay4396
@sanjevsplay4396 Год назад
Great material and finally I learnt to develop a web application!
@minindusheheran6624
@minindusheheran6624 3 года назад
Thank you, Really appreciate your work..!
@CharleswoodSpudzyofficial
@CharleswoodSpudzyofficial 2 года назад
Thank you for this awesome tutorial!
@helmialfathseptiana6383
@helmialfathseptiana6383 4 года назад
so clear. thx , Tim.
@carecavoador
@carecavoador 4 года назад
Hey, Tim. Would you mind showing us what packages have you installed on your Sublime Text?
@TechnicalAnkesh
@TechnicalAnkesh 3 года назад
Appreciate your work keep it up!
@JW-nr3zo
@JW-nr3zo 2 года назад
this is so good. great work! bless your day
@LilBabeChicken
@LilBabeChicken Год назад
Thanks Tim! These are great
@teclote
@teclote 7 месяцев назад
Very clear, thank you.
@adrianb1823
@adrianb1823 4 года назад
what a legend, very helpful
@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
@tymothylim6550
@tymothylim6550 3 года назад
Thank you very much for this video! It was very educational for me :)
@sabuein
@sabuein 2 года назад
Thank you so much, very helpful.
@odinsrensen7460
@odinsrensen7460 Год назад
this is exactly what I needed.
@nakamiakprossy7675
@nakamiakprossy7675 2 года назад
Thanks bro u r da best Tim. I really appreciate this because i have advanced alot
@barungh
@barungh 4 года назад
Waiting for next video impatiently ...
@marcin_lewandowski
@marcin_lewandowski 6 месяцев назад
Thanks a lot Tim
@DevinaArvind
@DevinaArvind 4 года назад
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.
@ga1z0
@ga1z0 2 года назад
absolute legend ty so much!!!
@ThomasJr
@ThomasJr 2 года назад
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).
@rohitkumarz
@rohitkumarz 4 года назад
Thank you so much for the videos learning a lot...:) lol @6:13
@prachiarora3180
@prachiarora3180 3 года назад
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.
@instylecasesinstylecases7239
@instylecasesinstylecases7239 3 года назад
Hi! Awesome! What would you recommend for hosting of the simple site writing in python?
@fggffg
@fggffg 10 месяцев назад
keep up the good work!
@mohammadhassan5240
@mohammadhassan5240 4 года назад
usefull and complete thank you
@bilalkhann16
@bilalkhann16 3 года назад
Thanks Tim!
@webdev10000hours
@webdev10000hours 3 года назад
How would you go about adding posts/blogs?
@zdravkogospocic9244
@zdravkogospocic9244 Год назад
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
@paulborstorf9538
@paulborstorf9538 3 года назад
Amazing tutorial
@user-sx3nl3ex8z
@user-sx3nl3ex8z 4 года назад
love this content:)
@conelrad1447
@conelrad1447 4 года назад
Thanks bro!!
@bismuthnickel
@bismuthnickel 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.
@zt.5677
@zt.5677 2 года назад
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?
@vijeandran
@vijeandran 2 года назад
HI, Instead of printing all the columns in GET request, How could I get only specific columns from the postgres table?
@harshith_takkala
@harshith_takkala 3 года назад
Awesome !!!
@sanjuwa2677
@sanjuwa2677 4 года назад
Thanks It worked
@hamidja1537
@hamidja1537 Год назад
Thanks for sharing
@ioannisventouzis
@ioannisventouzis 4 года назад
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 3 года назад
have you found the solution to pass 2 values?
@ArvindaSudan
@ArvindaSudan 3 года назад
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')
@originalbinaryhustler3876
@originalbinaryhustler3876 10 месяцев назад
God bless you bro ❤
@patrickstar6921
@patrickstar6921 Год назад
@TechWithTim Is there a way to pass data onto another function/url without redirecting to that url?
@AmanSingh-qd1cj
@AmanSingh-qd1cj 2 года назад
Thanks man!
@Ninniet-zt2tc
@Ninniet-zt2tc Год назад
MAN U HELPED ME SO FKING MUCH THXXX
@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.
@Nada-yc8uo
@Nada-yc8uo 4 года назад
cool, thanks
@rohandevaki4349
@rohandevaki4349 3 года назад
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.
@korhan1241
@korhan1241 3 года назад
This gives me error as "The method is not allowed for the requested URL." even if i wrote exactly the same code.
@rabi26
@rabi26 4 года назад
Could Flask be used instead of PHP on a WAMP server to host my own website on my laptop just for experimentation but also have the server connected online so people can visit it? I understand the security risks.
@dilshodusmanov1458
@dilshodusmanov1458 2 месяца назад
best video tutorial
@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.
@caliapster8720
@caliapster8720 4 года назад
ty *Tim sorry for saying your name wrong last time. I really appreciate these series.
@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 ..
@BlueBloodGamerz
@BlueBloodGamerz 3 года назад
If we on vsc will we choose pyton Or html for working?
@JWCLUTCH
@JWCLUTCH 2 года назад
Thanks.
@nakamiakprossy7675
@nakamiakprossy7675 2 года назад
Please Tim IOT toturials plz .I trully really like and follow your Tutorials
@AviPars
@AviPars Год назад
Can I have the server st a different domain than the front end ? How would i communicate? Via js request
@sainco3036
@sainco3036 4 года назад
thanks.
@Villentrethenmerth
@Villentrethenmerth 2 года назад
The key difference between GET and POST - GET doesn't have request body. That's why POST is secure - you can send encrypted data .
@hangchen
@hangchen 4 года назад
7:27 It seems you still get POST when you refresh it?
@Ahmed-bb4yp
@Ahmed-bb4yp 4 года назад
@@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 года назад
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 года назад
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 года назад
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!
@zedrobot5864
@zedrobot5864 4 года назад
Thank uuuuuuuu
@libeamlakbekele6345
@libeamlakbekele6345 2 года назад
Thanks
@cryptosauce_
@cryptosauce_ 3 года назад
ok then how do i then pass that user name onto a new page? i've tried setting up a new page with the same syntax used from the 1st page to the 2nd page, but trying to connect a 3rd page to the 2nd page isnt working for me...i'm having the hardest time with this...
@mariamkhanam4037
@mariamkhanam4037 2 года назад
Hello Tim, Can we redirect to a site with post request? Suppose, "website/shortit" need "url" arg as post request. Now in "website" if i click on submit button. It will process the request and and if any conditions come true. It will redirect to "website/shortit" with post request. Every conditions have different arg. . . Can we redirect with post request??
@liveleakveteran8881
@liveleakveteran8881 3 года назад
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
@compton8301
@compton8301 4 года назад
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! ™️💯
@TechWithTim
@TechWithTim 4 года назад
I have a course on teachable!
@originalbinaryhustler3876
@originalbinaryhustler3876 10 месяцев назад
​@@TechWithTimsend the link broski
@rasinthemarasinghe5229
@rasinthemarasinghe5229 9 месяцев назад
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.
@gavbav
@gavbav 3 года назад
What text editor is that?
@christophertroiano2081
@christophertroiano2081 2 года назад
For my 405 issue I had to change the html code to
@adedamolaafuye654
@adedamolaafuye654 3 года назад
My file directory is Flask_tutorials/tutotrial.py templates/login.html base. Html index. Html but I still keep getting jinja2 exceptions
@__________________________6910
@__________________________6910 3 года назад
me too
@truthhorizon5851
@truthhorizon5851 3 года назад
import request at top
@user-up3is5gi6b
@user-up3is5gi6b 4 месяца назад
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)
Далее
Flask Tutorial #5 - Sessions
13:51
Просмотров 266 тыс.
FastAPI, Flask or Django - Which Should You Use?
9:49
How to Process Incoming Request Data in Flask
26:43
Просмотров 69 тыс.
Make A Python Website As Fast As Possible!
22:21
Просмотров 665 тыс.
REST API With Flask & SQL Alchemy
35:25
Просмотров 295 тыс.
Python Requests | Get and Post Requests
4:54
Просмотров 122 тыс.