GET Method

5 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€85.78
List Price:  €120.09
You save:  €34.31
£74.57
List Price:  £104.41
You save:  £29.83
CA$137.96
List Price:  CA$193.15
You save:  CA$55.19
A$153.09
List Price:  A$214.33
You save:  A$61.24
S$128.82
List Price:  S$180.35
You save:  S$51.53
HK$780.13
List Price:  HK$1,092.22
You save:  HK$312.08
CHF 80.34
List Price:  CHF 112.49
You save:  CHF 32.14
NOK kr1,002.34
List Price:  NOK kr1,403.32
You save:  NOK kr400.97
DKK kr640.19
List Price:  DKK kr896.29
You save:  DKK kr256.10
NZ$170.50
List Price:  NZ$238.70
You save:  NZ$68.20
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,161.77
List Price:  ৳17,026.97
You save:  ৳4,865.19
₹8,804.49
List Price:  ₹12,326.64
You save:  ₹3,522.15
RM422.70
List Price:  RM591.80
You save:  RM169.10
₦153,629.63
List Price:  ₦215,087.63
You save:  ₦61,458
₨28,293.93
List Price:  ₨39,612.64
You save:  ₨11,318.70
฿3,234.32
List Price:  ฿4,528.18
You save:  ฿1,293.86
₺4,114.84
List Price:  ₺5,760.95
You save:  ₺1,646.10
B$547.02
List Price:  B$765.85
You save:  B$218.83
R1,762.70
List Price:  R2,467.86
You save:  R705.15
Лв167.91
List Price:  Лв235.08
You save:  Лв67.17
₩138,945.27
List Price:  ₩194,528.94
You save:  ₩55,583.66
₪336.77
List Price:  ₪471.49
You save:  ₪134.72
₱5,729.37
List Price:  ₱8,021.35
You save:  ₱2,291.98
¥14,854.21
List Price:  ¥20,796.49
You save:  ¥5,942.28
MX$1,870.35
List Price:  MX$2,618.57
You save:  MX$748.21
QR364.32
List Price:  QR510.06
You save:  QR145.74
P1,347.77
List Price:  P1,886.93
You save:  P539.16
KSh12,913.70
List Price:  KSh18,079.70
You save:  KSh5,166
E£4,858.94
List Price:  E£6,802.71
You save:  E£1,943.77
ብር14,285.86
List Price:  ብር20,000.78
You save:  ብር5,714.91
Kz91,186.39
List Price:  Kz127,664.59
You save:  Kz36,478.20
CLP$97,354.26
List Price:  CLP$136,299.86
You save:  CLP$38,945.60
CN¥713
List Price:  CN¥998.24
You save:  CN¥285.23
RD$6,298.47
List Price:  RD$8,818.11
You save:  RD$2,519.64
DA12,991.06
List Price:  DA18,188
You save:  DA5,196.94
FJ$226.12
List Price:  FJ$316.58
You save:  FJ$90.46
Q766.32
List Price:  Q1,072.87
You save:  Q306.55
GY$20,908.02
List Price:  GY$29,272.07
You save:  GY$8,364.04
ISK kr12,319.76
List Price:  ISK kr17,248.16
You save:  ISK kr4,928.40
DH904.41
List Price:  DH1,266.21
You save:  DH361.80
L1,648.78
List Price:  L2,308.36
You save:  L659.58
ден5,288.25
List Price:  ден7,403.76
You save:  ден2,115.51
MOP$803.86
List Price:  MOP$1,125.44
You save:  MOP$321.57
N$1,771.48
List Price:  N$2,480.14
You save:  N$708.66
C$3,679.53
List Price:  C$5,151.49
You save:  C$1,471.96
रु14,112.30
List Price:  रु19,757.79
You save:  रु5,645.48
S/353.41
List Price:  S/494.79
You save:  S/141.37
K419.26
List Price:  K586.98
You save:  K167.72
SAR375.19
List Price:  SAR525.29
You save:  SAR150.09
ZK2,368.97
List Price:  ZK3,316.66
You save:  ZK947.68
L435.57
List Price:  L609.82
You save:  L174.24
Kč2,097.30
List Price:  Kč2,936.30
You save:  Kč839
Ft33,774.46
List Price:  Ft47,285.59
You save:  Ft13,511.13
SEK kr943.78
List Price:  SEK kr1,321.33
You save:  SEK kr377.55
ARS$135,932.91
List Price:  ARS$190,311.51
You save:  ARS$54,378.60
Bs690.86
List Price:  Bs967.24
You save:  Bs276.37
COP$400,952.08
List Price:  COP$561,348.96
You save:  COP$160,396.87
₡50,547.65
List Price:  ₡70,768.74
You save:  ₡20,221.08
L2,635.35
List Price:  L3,689.60
You save:  L1,054.24
₲722,145.91
List Price:  ₲1,011,033.16
You save:  ₲288,887.25
$U4,001.81
List Price:  $U5,602.70
You save:  $U1,600.88
zł364.73
List Price:  zł510.64
You save:  zł145.90
Already have an account? Log In

Transcript

Hello, in this video we are going to look at handling a get request using a form in Python. So we got this CGI program. Fantastic. Make sure you got this. And now we're going to modify this. So we can you know accept some form values.

So first of all you want to import CGI, and CGI a TCP module. Now you want to create a form. And this form will, this variable will basically allow us to access the value of fields called fields stored in the method in Python, and now we just do username, a mapping username, where's that coming from? We're actually going to construct a form very soon. So that'll mean, the form the name that you set for us and which we'll be using, again, just bear with me. Get the value Copy that.

And because we're gonna have to input the email address and email address, and now we're just going to print it out. So here, you could enclose the variables within, you know, like a print tag, with all the HTML tags, and the styling and all that good stuff as an extra task. I want you to do that. I'm just going to get working and printing out the email address. Obviously, this will work at the moment, we need to create a new file. And I'll save it I'm going to call it get file, get file.

And in here, what we are going to do is do a basic doctype. html file. It couldn't be done. It has to be HTML file. It could be a guess a Python file, or even a PHP file that has hate and hate. Email form on there that Submit.

But just for simplicity when it you know, it's making HTML file, HTML. And here I'm gonna add just a basic structure. In here we'll have next set the character set, and you'll set it to the really famous UTF. So now we are going to put title and this will be total. And now we're going to do a body full. And the action is just the file that we want to go to.

And for us, it's in the same directory. So we just filed it in a different directory. Don't just put the current directory method will be get you are interested in how to do post, watch this video. And we'll be extending this to do POST requests as well in the next video, though in here below basic forms and username, input and this input type text, the name and this is what this name right here this username is what is referred in here so if you change this, you would have to change it here as well. So just bear that in mind. And now we're gonna copy that address.

Again, you know, it could be any sort of form that you want. This is a very simple form, but it's just illustrate Some data we get, why does one get requested really, format is the easiest and best way to quickly type. This is on the submit button that allows you to submit. If you save that, go to our website. And we need to go to this one first because this will call the other one get for the HTML. So we got the button.

So if I type in my name, type in Hello, hello clearly my email address, click Submit. This takes us to the file.pi file for them to snap it over here. So it's taken us to here and what it does is it gets this crisis form field storage and it gets the username and email address values which are in the URL can get valued or sent via the URL. Any printer here this all on one nine because this is a very very simple print. And like I said at the next task on waiting close it into you know, HTML tags if you can hide enclose a variable we've already covered that with strings and and the advanced printing tutorials or feel free to go back and check them out. And obviously if I were to necessary change value here and say for Han, or like for us seven, then it has that value right here.

So that's it for this video. Thanks for watching. In the next video we are going to cover post methods and I look forward to seeing you there

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.