我正在尝试通过 HTTP 将参数传递给 python 脚本
例如http://www.domain.com/script.py?param=value
在某些示例中,我可以看到人们使用 cgi.FieldStorage() 函数来检索 GET 参数,但我无法使其工作
这是我的代码:
import cgi
print "Content-type: text/html\n"
arguments = cgi.FieldStorage()
print arguments
通过浏览器或通过命令行使用 wget 发出 http 请求,这是我为对象获得的输出arguments
:
FieldStorage(None, None, [])
似乎没有存储 GET 参数
我错过了什么?