Checking HTP headers and proxy requests.
Hello, everyone.
Actually, we're seeing my laptop with this ridiculous message here that we had left from the last lecture.
But anyways, today we're going to.
Talk about the HTP beheaders and basically how to shake them, so we're going to write some quote who
are going to create the file and run it from the terminal.
Now, what I'm going to do is to create a new python file in the file.
Will be called slash Heather.
OK, forget Heather and.
We're going to hear the common response that he orders in order to get.
The headers of the Web service response, so you can see basically how we can assess their response.
Now, let's first assess the Python folder, which is some user slash bill slash in the Python three.
And then let's import.
All requests.
OK, and let's create a response where our data from our request will will be basically recorded.
So I do requests that get in here in the break.
All right, H.T..
Oh, sorry.
Yes, HTP.
And get help, dot com.
OK.
And then we're going to do an exception here, so I will do three.
And then for.
Kee.
Value in.
Response to that headers, both items, and I hope you remember actually how the killers were looking
like basically their dictionary, which has a key and the voice of the kid has a vowel.
For example, the page the key page has the value about all the key.
Your address, here's a vowel, for example, GitHub dot com.
Quite simple.
So for each Kinabalu, we're going to print.
Percent is and then again, percent is, and the values that we're going to print are key and value
that it.
OK, and then let's try it, except.
And here will create exception as Arabs who are going to display our exceptional as error and will print.
Now do again, percent is five.
And here are what percent?
Error.
OK, let's save that and let's actually run it from the terminal.
So, Lynne, open the terminal and I hear the final moult letting her in the right folder.
Yes, we are.
So I will do Python.
And underscore here those lights from the file and here we're getting on there.
Let's see if we got error actually somewhere here.
So I think I miss the percent saying, OK.
Let's run the file again and see if we're going to get somewhere.
So now that no, we don't get there all this time.
So now here you can see the script execution of the GitHub dot com.
And you can see here that how the content is encoded, the transfer.
The types of ranges that they have and so on are quite useful information for you.
So this is how this works.
Let's see now how we can make a proxy requests.
So this is actually a very interesting feature of the request by Python, because it allows you to use
a proxy or intermediate machine in order to make a request through the Web.
So to do that, you can go in python mode.
So I write Python and you can separate proxy.
Equals and the right protocol.
So protocol and then I will close this parenthesis here and then let's write IP and then port.
OK, and then some additional data.
OK, this is basically the way that you are making a proxy.
I just misheard the parentheses, sort of the quotation mark actually missed that.
So, yeah, this is how you define it.
And basically this is the key and there is the value, OK?
And the same is with IP.
So if I write on the right wrist, response equals request that I get.
Actually before that, let me first import the request because they want the program to actually run.
You know, let's import requests.
OK, and then let's fight HTP underscore proxy will be equal to.
HTP, and then they were right, IP
address, OK, and then they were right.
That's it.
OK, and then we can do Piroxicam.
Their victory will be equal to age TTP, OK, and then we can do HTP underscore proxy.
That's it.
Actually, in particular brackets here, and this is because the proxy parameter usually needs to be
passed in the formal directory, so we need to create a directory in order to pass this parameter.
So when I hit enter and just once I said that and then let's do.
Requests.
But to get and then I'll write.
HTP.
YouTube and dot com Colma and then.
Paralysis equals proxy underscore directory that already created, and this is basically the way that
we're getting the proxy directory.
And so this is everything that they want to explain in that future, I hope.
It was interesting.
Thank you very much for watching.
And I'll see you in the next lecture.