Python appreciated request module in the module request module python

This switched: https: //www.cnblogs.com/ydy11/p/8902631.html (copyright belongs to the original author, because thought that it was very good, so the quote)

Appreciated request module python modules,

       request module is a module for access to the network,

1, no matter what kind of script writing we all know that first of all we need to import the module

 

2, since the module is a network access module we gave him a pass url, send a get request.

Because in doing ctf topic, so already the subject of an example url

After sending, we will get the corresponding object re, appropriate information which is what we want. Here, if no processing output, then returns a status code of the request, if you want to appear content, you need to add .text. Output string format. Similarly post delivery is the same.

3, the request with parameters

get request: send get request, his argument is a keyword params passed. Let's test

post request: When sending a post request to transfer data to the keyword parameter, test

4, the fetch response header a field

This we can use headers, test

Get All Fields

Gets the specified fields, such as the subject, I want to get FLAG field

'Re.headers' acquisition is a dictionary, we want to get one, you can get through this form.

If we want to get request headers can be directly re.request.headers, test

End of the article, send ctf subject python script

 

Guess you like

Origin www.cnblogs.com/kaishirenshi/p/11209047.html