27 lines
545 B
Python
27 lines
545 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.32.3\r\n"
|
|
"Accept-Encoding: gzip, deflate\r\n"
|
|
"Accept: */*\r\n"
|
|
"Connection: keep-alive\r\n"
|
|
"\r\n"
|
|
)
|
|
|
|
client.sendall(request.encode())
|
|
|
|
# Получаем ответ
|
|
response = b""
|
|
while True:
|
|
data = client.recv(4096)
|
|
if not data:
|
|
break
|
|
response += data
|
|
|
|
print(response.decode()[:500])
|
|
client.close() |