The other day I've had a question asked:
How do you send a form data to a server and get the reply?
My solution involves python-requests:
__author__ = 'Laur IVAN'
import requests
proxies = {
'http': 'http://.../',
'https': 'http://.../'
}
payload = {
'Sentence': 'There was a little red hat.',
'Constituents': 'on',
'NullLinks': 'on',
'AllLinkages': 'on',
'LinkDisplay': 'on',
'ShortLegth': '6',
'PageFile': '/docs/submit-sentence-4.html',
'InputFile': "/scripts/input-to-parser",
'Maintainer': "[email protected]"
}
r = requests.post(
"http://www.link.cs.cmu.edu/cgi-bin/link/construct-page-4.cgi#submit",
data=payload, proxies=proxies)
print r.text
r.text
contains the reply HTML page, which then needs to be processed via e.g. python's DOM processing module or BeautifulSoup (if you're looking for something more tolerant).
HTH,
Member discussion: