I have a small question about a problem I encountered writing my first python web application.
I have a form on my site which action is a python file. The forms posts the values of 2 inputboxes in a post request and my pythonfile will catch those and do something with them. When testing my program I'd like to be able to post these parameters on the command line when in ssh, something like:
python twitter.py -user1="bob" -user2="labla"
However I can't seem to get it to work and couldn't find anything on google.
For now my python file looks like this:
#!/usr/bin/python
import cgi
import cgitb; cgitb.enable()
import nltk
form = cgi.FieldStorage()
reshtml = """Content-Type: text/html\n"""
print reshtml
user1 = form['user1'].value
user2 = form['user2'].value
print user1 + " , " + user2
So how do I 'fake' a form POST request on the commandline in ssh with python?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.