Socket

Use to make all type of request. Either IPv4, IPv6 or different requests

import socket

HOST = "localhost"
PORT = 3000

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    
    request = "GET / HTTP/1.1\r\n"
    request += f"Host: localhost\r\n"
    request += "Connection: close\r\n\r\n"  # End the request with a blank line

    # Send the HTTP request
    s.send(request.encode())
    data = s.recv(1024)

print("received", data)