Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 925
cfischer Avatar asked Sep 13 '09 13:09

cfischer


1 Answers

import os

if os.environ['REQUEST_METHOD'] == 'GET':
    # blah
like image 88
Ned Batchelder Avatar answered Oct 29 '22 02:10

Ned Batchelder