https
This commit is contained in:
parent
66bf5285c4
commit
c3417ce6a9
5
http_requests.py
Normal file
5
http_requests.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
response = requests.get("http://vyatsu.ru")
|
||||||
|
print(f"Статус: {response.status_code}")
|
||||||
|
print(response.text[:500])
|
||||||
17
http_socket.py
Normal file
17
http_socket.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import socket
|
||||||
|
|
||||||
|
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
client.connect(("vyatsu.ru", 80))
|
||||||
|
|
||||||
|
request = "GET / HTTP/1.1\r\nHost: vyatsu.ru\r\nConnection: close\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()
|
||||||
Loading…
Reference in New Issue
Block a user