42 lines
671 B
Python
42 lines
671 B
Python
import socket
|
|
|
|
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
print("Подключение к серверу...")
|
|
|
|
client.connect(("vyatsu.ru", 80))
|
|
|
|
request = (
|
|
"GET / HTTP/1.1\r\n"
|
|
"Host: vyatsu.ru\r\n"
|
|
"User-Agent: Mozilla/5.0\r\n"
|
|
"Accept: */*\r\n"
|
|
"Connection: close\r\n"
|
|
"\r\n"
|
|
)
|
|
|
|
print("Отправка запроса...\n")
|
|
|
|
client.sendall(request.encode())
|
|
|
|
response = b""
|
|
|
|
running = True
|
|
|
|
while running:
|
|
|
|
data = client.recv(4096)
|
|
|
|
if data:
|
|
response += data
|
|
else:
|
|
running = False
|
|
|
|
decoded = response.decode(errors="ignore")
|
|
|
|
print(decoded[:5000])
|
|
|
|
client.close()
|
|
|
|
input("\nНажми Enter...")
|