While this code works, it sends "Bad Request".
import socket, ssl
token = 'NzMyMzQ1MTcwNjK2MTR5OEU3.XrzQug.BQzbrckR-THB9eRwZi3Dn08BWrM'
HOST = "discord.com"
PORT = 443
t = 'POST / HTTP/1.0
Authentication: Bot {token}
Host: discord.com/api/guilds/{702627382091186318}/channels
'
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s_sock = context.wrap_socket(s, server_hostname=HOST)
s_sock.connect((HOST, 443))
s_sock.sendall(t.encode())
f = s_sock.recv(7000).decode()
print(f)
s_sock.close()
Note: this is not a real token.
See Question&Answers more detail:os