Python code implements interface automation testing (Requests library)


1. HTTP protocol

1. Introduction to HTTP

The HTTP (HyperText Transfer Protocol) protocol is a protocol based on the application layer, which completes a series of operation processes such as sending requests from the client to the server. It is referred to as the Hypertext Transfer Protocol in Chinese.

HTTP was born in March 1989. It was originally proposed by Dr. Tim Berners-Lee to realize the idea of ​​sharing knowledge among researchers across the ocean. The HTTP/1.1 version was released in January 1997, which is currently the more mainstream version of the HTTP protocol. Since HTTP is a protocol based on the application layer, the client does not need to pay attention to the underlying network details, and the connection request is handled by the reliable transport protocol TCP/IP.

When the client sends a request to the server, communication is established between the client and the server. After the request is completed, the communication between the client and the server is completed. The request flow is shown in the figure.

The specific steps are:

  1. Before sending the request, the client and the server request to establish communication and open the TCP connection;
  2. After the TCP connection is established, the client sends a request to the server;
  3. The server replies to the client after receiving the response;
  4. The client closes the TCP connection after receiving the response from the server;

For example, visit the Baidu homepage, open the browser, enter https://www.baidu.com/ domain name, and press the Enter key to jump to the Baidu homepage. In a complete HTTP request process, the client sends an HTTP request to the server, which needs to clearly tell the server the address of the request, that is, the Uniform Resource Locator URL. The URL is mainly composed of three parts, namely the HTTP protocol y

Guess you like

Origin blog.csdn.net/qq_35029061/article/details/130461012