You need to send a version message (and receiving the correspondant verack) before sending anything else. Here is a quickly patched version of your script which handles the version message:
PEER_IP = "127.0.0.1"
PEER_PORT = 8333
nonce = (random.getrandbits(64)).to_bytes(8, ...