Your script is supposed to be run as a CGI
script by a web-server, which sets environment variables like REMOTE_ADDR
, REQUEST_METHOD
, etc.
You are running the script by yourself, and these environment variables are not available. That's why you get the KeyError
.