20 lines
523 B
Python
20 lines
523 B
Python
import socket
|
|
|
|
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
client.connect(('vyatsu.ru', 80))
|
|
|
|
request = (
|
|
"GET / HTTP/1.1\r\n"
|
|
"Host: vyatsu.ru\r\n"
|
|
"User-Agent: python-requests/2.31.0\r\n"
|
|
"Accept-Encoding: gzip, deflate, br\r\n"
|
|
"Accept: */*\r\n"
|
|
"Connection: keep-alive\r\n"
|
|
"\r\n"
|
|
)
|
|
|
|
client.sendall(request.encode())
|
|
response = client.recv(4096)
|
|
print(response.decode(errors="replace")) # Используем replace на случай кодировки gzip
|
|
client.close()
|