27 lines
660 B
Python
27 lines
660 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.33.1\r\n"
|
|
"Accept-Encoding: gzip, deflate, zstd\r\n"
|
|
"Accept: */*\r\n"
|
|
"Connection: keep-alive\r\n"
|
|
"\r\n")
|
|
|
|
client.sendall(request.encode())
|
|
|
|
full_response = b""
|
|
while True:
|
|
try:
|
|
chunk = client.recv(4096)
|
|
if not chunk:
|
|
break
|
|
full_response += chunk
|
|
except socket.timeout:
|
|
break
|
|
|
|
print(full_response.decode('utf-8', errors='replace'))
|
|
client.close() |