I am trying to post query to a webserver : http://www.imtech.res.in/raghava/antibp/submit.html
but I am getting an error
Traceback (most recent call last):
File "crawler.py", line 4, in <module>
conn = httplib.HTTPConnection("http://www.imtech.res.in/raghava/antibp/submit.html")
File "/usr/lib/python2.7/httplib.py", line 704, in __init__
self._set_hostport(host, port)
File "/usr/lib/python2.7/httplib.py", line 732, in _set_hostport
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
httplib.InvalidURL: nonnumeric port: '//www.imtech.res.in/raghava/antibp/submit.html'
The python script is shown below:
import httplib, urllib
params = urllib.urlencode({'seqname':'GICACRRRFCPNSERFSGYCRVNGARYVRCCSRR','format':'Amino acid sequence in single letter code', 'terminus':'N-terminus', 'method':'svm', 'svm_th':'0', 'type': 'Submit'})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection("http://www.imtech.res.in/raghava/antibp/submit.html")
conn.request("POST", "", params, headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()
What could be the problem? Thank you.
Try omitting the
http://
part in the URL you supply tohttplib.HTTPConnection()
. The method seems to split by:
and use the part after it as the port number.I have made changes, that is
but I am getting the error:
Please assist.