Q:

Detecting the http request type (GET, HEAD, etc) from a python cgi

How can I find out the http request my python cgi received?  I need different behaviors for HEAD and GET. 
Thanks! 

A:

import os

if os.environ['REQUEST_METHOD'] == 'GET':
    # blah

