How do I 'fake' a form POST request on the commandline in ssh with python? -


i have small question problem encountered writing first python web application.

i have form on site action python file. forms posts values of 2 inputboxes in post request , pythonfile catch , them. when testing program i'd able post these parameters on command line when in ssh, like:

python twitter.py -user1="bob" -user2="labla"

however can't seem work , couldn't find on google.

for python file looks 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 'fake' form post request on commandline in ssh python?

you can use httplib2 post requests server. file uploading (multipart requests) should use poster.

you might need form before can post server checks security tokens (hidden fields or cookies)


Comments