I need to write a script that will automatically submit the form at http://iedb.ebi.ac.uk/tools/ElliPro/iedb_input by choosing the ” Protein structure (Go to step 2b)” and then entering some value in the text field named “pdbId” without uploading any file.
I wrote te following script but it gives me back the same page withoutany submission occuring . What is wrong ?
import httplib2
http = httplib2.Http()
url = 'http://iedb.ebi.ac.uk/tools/ElliPro/iedb_input'
body = { 'pdbFile' : '', 'protein_type':'structure','pdbId':'5LYM' }
headers = {'Content-type': 'application/x-www-form-urlencoded','User-Agent':'Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'}
response, content = http.request(url, 'POST', headers=headers, body=urllib.urlencode(body))
print content
I used mechanize finally and it worked !