Я пытаюсь отправить запрос GET на сервер с Python 3.8.2. Однако когда я выполняю команду print(sock.recv(1024))
, она просто возвращает инструкции, которые были мне даны:
b'\n Iniate communication with GET to retrieve the encrypted messages.\n\n Then return the messages decrypted to the server, taking care to ensure each message is split on to a newline\n '
Это мой код:
#
# Connect over TCP to the following server 'localhost', 10000
# Initiate communication with GET to retrieve the encrypted messages.
# Then return the messages decrypted to the server,
# taking care to ensure each message is split on to a newline
#
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 10000))
sock.send(b"GET / HTTP/1.1\r\nHost:127.0.0.1\r\n\r\n")
print(sock.recv(1024))
Что-то не так с запросом GET?