1 00:00:05,030 --> 00:00:09,540 Checking HTP headers and proxy requests. 2 00:00:10,460 --> 00:00:11,360 Hello, everyone. 3 00:00:12,440 --> 00:00:18,620 Actually, we're seeing my laptop with this ridiculous message here that we had left from the last lecture. 4 00:00:18,800 --> 00:00:21,290 But anyways, today we're going to. 5 00:00:22,450 --> 00:00:28,990 Talk about the HTP beheaders and basically how to shake them, so we're going to write some quote who 6 00:00:28,990 --> 00:00:33,700 are going to create the file and run it from the terminal. 7 00:00:34,210 --> 00:00:39,370 Now, what I'm going to do is to create a new python file in the file. 8 00:00:41,430 --> 00:00:47,250 Will be called slash Heather. 9 00:00:48,060 --> 00:00:50,700 OK, forget Heather and. 10 00:00:53,110 --> 00:00:59,320 We're going to hear the common response that he orders in order to get. 11 00:01:00,440 --> 00:01:07,290 The headers of the Web service response, so you can see basically how we can assess their response. 12 00:01:07,730 --> 00:01:20,030 Now, let's first assess the Python folder, which is some user slash bill slash in the Python three. 13 00:01:21,970 --> 00:01:24,100 And then let's import. 14 00:01:27,400 --> 00:01:28,480 All requests. 15 00:01:28,960 --> 00:01:39,880 OK, and let's create a response where our data from our request will will be basically recorded. 16 00:01:40,210 --> 00:01:46,630 So I do requests that get in here in the break. 17 00:01:46,880 --> 00:01:48,640 All right, H.T.. 18 00:01:49,220 --> 00:01:49,830 Oh, sorry. 19 00:01:50,770 --> 00:01:52,300 Yes, HTP. 20 00:01:55,540 --> 00:01:57,470 And get help, dot com. 21 00:01:58,100 --> 00:01:58,610 OK. 22 00:02:00,070 --> 00:02:04,270 And then we're going to do an exception here, so I will do three. 23 00:02:06,810 --> 00:02:08,190 And then for. 24 00:02:09,990 --> 00:02:10,440 Kee. 25 00:02:13,460 --> 00:02:16,150 Value in. 26 00:02:17,600 --> 00:02:28,640 Response to that headers, both items, and I hope you remember actually how the killers were looking 27 00:02:28,640 --> 00:02:33,500 like basically their dictionary, which has a key and the voice of the kid has a vowel. 28 00:02:33,500 --> 00:02:40,340 For example, the page the key page has the value about all the key. 29 00:02:42,840 --> 00:02:46,620 Your address, here's a vowel, for example, GitHub dot com. 30 00:02:47,950 --> 00:02:48,710 Quite simple. 31 00:02:50,110 --> 00:02:56,470 So for each Kinabalu, we're going to print. 32 00:02:59,690 --> 00:03:11,750 Percent is and then again, percent is, and the values that we're going to print are key and value 33 00:03:12,620 --> 00:03:13,420 that it. 34 00:03:16,260 --> 00:03:21,420 OK, and then let's try it, except. 35 00:03:23,720 --> 00:03:32,030 And here will create exception as Arabs who are going to display our exceptional as error and will print. 36 00:03:34,630 --> 00:03:38,250 Now do again, percent is five. 37 00:03:40,680 --> 00:03:42,900 And here are what percent? 38 00:03:45,080 --> 00:03:45,560 Error. 39 00:03:46,580 --> 00:03:51,410 OK, let's save that and let's actually run it from the terminal. 40 00:03:52,890 --> 00:04:00,090 So, Lynne, open the terminal and I hear the final moult letting her in the right folder. 41 00:04:00,150 --> 00:04:00,880 Yes, we are. 42 00:04:01,410 --> 00:04:04,440 So I will do Python. 43 00:04:06,790 --> 00:04:12,500 And underscore here those lights from the file and here we're getting on there. 44 00:04:12,520 --> 00:04:15,880 Let's see if we got error actually somewhere here. 45 00:04:17,230 --> 00:04:20,530 So I think I miss the percent saying, OK. 46 00:04:22,230 --> 00:04:24,730 Let's run the file again and see if we're going to get somewhere. 47 00:04:25,810 --> 00:04:28,280 So now that no, we don't get there all this time. 48 00:04:29,100 --> 00:04:33,090 So now here you can see the script execution of the GitHub dot com. 49 00:04:33,960 --> 00:04:39,290 And you can see here that how the content is encoded, the transfer. 50 00:04:41,130 --> 00:04:47,550 The types of ranges that they have and so on are quite useful information for you. 51 00:04:48,720 --> 00:04:50,510 So this is how this works. 52 00:04:50,850 --> 00:04:53,580 Let's see now how we can make a proxy requests. 53 00:04:54,480 --> 00:05:04,800 So this is actually a very interesting feature of the request by Python, because it allows you to use 54 00:05:04,800 --> 00:05:09,190 a proxy or intermediate machine in order to make a request through the Web. 55 00:05:09,990 --> 00:05:13,650 So to do that, you can go in python mode. 56 00:05:13,660 --> 00:05:19,530 So I write Python and you can separate proxy. 57 00:05:21,480 --> 00:05:24,820 Equals and the right protocol. 58 00:05:25,800 --> 00:05:37,650 So protocol and then I will close this parenthesis here and then let's write IP and then port. 59 00:05:40,100 --> 00:05:43,660 OK, and then some additional data. 60 00:05:45,390 --> 00:05:49,090 OK, this is basically the way that you are making a proxy. 61 00:05:50,060 --> 00:05:57,240 I just misheard the parentheses, sort of the quotation mark actually missed that. 62 00:05:57,990 --> 00:05:59,660 So, yeah, this is how you define it. 63 00:05:59,850 --> 00:06:04,370 And basically this is the key and there is the value, OK? 64 00:06:04,540 --> 00:06:06,040 And the same is with IP. 65 00:06:06,990 --> 00:06:19,230 So if I write on the right wrist, response equals request that I get. 66 00:06:19,980 --> 00:06:25,200 Actually before that, let me first import the request because they want the program to actually run. 67 00:06:25,200 --> 00:06:30,300 You know, let's import requests. 68 00:06:32,870 --> 00:06:42,320 OK, and then let's fight HTP underscore proxy will be equal to. 69 00:06:44,980 --> 00:06:51,340 HTP, and then they were right, IP 70 00:06:53,650 --> 00:06:57,820 address, OK, and then they were right. 71 00:06:59,110 --> 00:06:59,790 That's it. 72 00:07:01,850 --> 00:07:04,850 OK, and then we can do Piroxicam. 73 00:07:07,660 --> 00:07:21,850 Their victory will be equal to age TTP, OK, and then we can do HTP underscore proxy. 74 00:07:23,820 --> 00:07:24,590 That's it. 75 00:07:25,920 --> 00:07:31,890 Actually, in particular brackets here, and this is because the proxy parameter usually needs to be 76 00:07:31,890 --> 00:07:39,330 passed in the formal directory, so we need to create a directory in order to pass this parameter. 77 00:07:40,050 --> 00:07:46,440 So when I hit enter and just once I said that and then let's do. 78 00:07:49,120 --> 00:07:50,110 Requests. 79 00:07:52,270 --> 00:07:55,990 But to get and then I'll write. 80 00:07:59,030 --> 00:08:00,380 HTP. 81 00:08:02,870 --> 00:08:07,520 YouTube and dot com Colma and then. 82 00:08:10,570 --> 00:08:21,040 Paralysis equals proxy underscore directory that already created, and this is basically the way that 83 00:08:21,070 --> 00:08:24,280 we're getting the proxy directory. 84 00:08:25,210 --> 00:08:29,120 And so this is everything that they want to explain in that future, I hope. 85 00:08:29,140 --> 00:08:30,110 It was interesting. 86 00:08:30,460 --> 00:08:31,800 Thank you very much for watching. 87 00:08:31,810 --> 00:08:33,850 And I'll see you in the next lecture.