Hello, friends, in this video, we shall discuss the different HTP matters and how they are used along
with the flask application.
AWB stands for hypertext transfer protocol.
This is an application protocol and it is used for distributing Calavera to hypermedia information systems.
HDB is the foundation of all the data communication activities in the W w w are World Wide Web hypertext
is a structured text that uses the logical links between the nodes that are containing the text.
This protocol is to exchange or transfer the hypertext.
Its name itself suggests that it is used to exchange or transfer the hypertext.
There's a difference between the text and hypertext.
SCDP defines the methods to indicate the desired action to be performed on whatever resource is to be
communicated, to be used for communication resource.
Maybe this is maybe a file or a resource maybe and the output of some executable program.
So any such resource may be exchanged between one node to the other node and that exchange or transfer
is controlled by this EDP to begin with, HDB 1.0 was the specification that was defined and in which
it started with two methods get and post, let alone the revision of HTP specifications.
But it should be one point, one error, some additional methods like put, delete, trace and connect.
So all in all, there should be 1.0 provided to the most two most popular HGP methods plus get and post.
But then the other matters are also prevalent.
Let us see the use and the definitions of all these methods, one by one.
As I said, the gate and the Post are the two most commonly used CETP methods of which gate is the default
method?
It is, it sends the data in the plane unencrypted manner most.
As I say, it is the most commonly used method.
Post method is another commonly used method, which was in fact the one of the earliest methods that
were defined.
It is used to send the original data to the server, especially if you have a stable form and the form
that has to be submitted to the server, then it is packaged inside a post request.
It is used to send the e-mail form letter to the server, the data server data that is, that the server
receives by the post method is not gatecrashed by the server.
Unlike the gate method where the server remembers the data that was earlier received by the post, data
is not retained by the server.
That is another advantage of that.
Using the post with the additional methods that were introduced in HDB.
One point one include a header method.
It is more or less the same as get, but it doesn't have the response body.
So which means what if the server receives the request by the method?
It doesn't have to send the response.
Only the header part of the EDP is received from the client.
But the method is again a very useful variation.
It replaces all the current representations of the target resource.
So which means what if the request for the particular resource is already received before and a subsequent
put method will replace the earlier request?
Current representation will be replaced by the request that has been set.
So that is put.
Delete it, remove the current representation of the target was the requested target will be deleted.
It will be processed and deleted.
Press equals the received request so that the client can see any changes or additions have been done
in the request or not and cannot convert the request connection to a transparent DCP Turnell, especially
useful for the SSL encrypted communication.
So these are the different methods of which we shall use the get that post method.
So here the rule of rather the rule decorator, which defines a you all can be given an additional parameter,
the rule function of the application object can be given an additional parameter Collette's methods
by default.
The method is always good, but you can change the preference by giving additional methods.
So, for example, you see here, Eppy, not root the you are and that is defined as less function it
can have do in front of the methods attribute.
I'm giving a list object in which these two methods first and get are used.
So the default is good, but then it can also be a positive method.
So insert the definition of the function.
You are identifying whether the request has been received as or get so how that can be done by using
the requested documents.
So obviously your
import statement must have, in addition to the last class, you should also import request object.
So the request object has a method or a function method and its value will be whichever method had been
used by the client.
If it is equal to post, then this block will be executed.
Right.
And if it is not POS, then which means what?
You are given two options.
So if it is equal to post, then this block, otherwise this block, that means this will be executer
when the method is get.
So that is how you can segregate the two activities of sending a request, either get method or method
that business logic of processing the data, processing the function of the view function.
This to be done when the method is both the part of it and when the matter is get so such a use of get
and post methods will.
Now I will show you with the help of an example in which first I will show you how the postmortem is
used and also get the method used with the help of a demonstration example in front of you in order
to study the different HTP methods in the flask environment.
Let us first create an HTML form.
In which there is a input type equal to text, text, if there was name of the full list and and then
there is a submit button.
So if you click on the submit button, the form data is going to be sent to this wall, which is mentioned
in the action attribute of the form.
And it is localhost 5000 login.
So this is the you are.
To which the data is going to be said and to begin with, we shall put the metal attribute of the form
equal to post.
So this is a simple e-mail form that we have created.
And now this is the Python script in which this log in Eurail is defined and it is bound with the view
function called Log-in.
By default, this route decorator method.
You know, accepts the data from the brother in the get method, but you can alter their behavior by
mentioning the value to these methods parameter which can be provided to the root method.
So metallurgic, although there are two possible values are given in the list.
Which is the value of these methods parameter.
So we have written a stable form which sends the letter in the post midterm.
So if it is equal to the post, the request does not matter the value of the request or method attribute
of this request object, then what will happen with the data associated with the barometer of the form
will be stored in the variable called user and.
The browser will be redirected towards the associated Eurail with the function called Wellcome, which
is already defined here.
We have a function called as welcome, welcome, the variable part.
So if it.
If the farm sells, let us anvil as the name, as a value associated with the request, not form animal,
so user will be Annville.
So this will come rule and associated.
View function welcome will receive Namir, the output will be welcome.
Whatever name that he will be providing, this will happen when.
The data is sent in the post ometer.
If it is not, send in the post method, otherwise it should be get because there is a second option
is get.
So the value associated with the enum attribute of the form can be fetched by using trick with dart.
Energy is not get.
So the.
Entry in the textfield will be stored in the variable called user, and the same function will be will
again be called in, the output of the output of both cases will be the same will come will, for instance,
if the text box in the next e-mail form is entered with Envir.
But in the first place, what happens when?
The farm uses.
Post metal attribute or get better that we have to see.
So this is the explanation to this Log-in view function.
Now, what we will do, we will open that e-mail form as it is, we have seen that the metrological
the post is used, so we expect this function to be executed.
Output will be welcome, and we'll.
And then we will change the.
Metal attribute of the form from push to get, and we will see that this will be executed.
So let us now open the browser first.
Open the.
Esteemable form and CDG, see how the redirection takes place with the help of the you are all for function.
So this is the former chairman that we are open inside the textbooks, let me.
Enter the data, if I press this button, the form data will now be redirected towards the localhost
5000 log in using the post emitter.
So therefore.
The associated review function to the in you are in will identify that the metal is post and therefore
the data will be redirected towards the you are associated with a welcome name is called the Envir.
So first, we have to start the server.
And then press the submit button.
So the name of the script is Start with.
I will start the server now.
And then.
Press on the submit button.
It was showing you welcome the.
That is what is to be expected.
Now, change the method attribute to.
Get from post.
And open the Australian farm again.
So the same is form is in front of you.
Will enter the data again and the reason we're running, so I'll press on this button.
That is the.
Brother is redirected towards the welcome and will you all see what is being displayed, but now this
time the get method is in use, so that is all his people can get get methods can be used to.
Send the data to the associated you are a.