I don't know much about the mechanize; I have several text files that I want to upload to a web tool to get the results. I tried submitting with a fasta/text file and the corresponding input parameters. I am using the following python code:
import requests
import os
import mechanized
import csv
loc="C:/Users/Binni/Documents/Provean/"
files=os.listdir(loc)
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_handle_refresh(False)
url = "https://snps.biofold.org/meta-snp/"
br.open(url)
For file in files:
#print(file)
if file == "SP11_00001.fasta":
ip=os.path.join(loc,file)
With open(ip) as f:
data = f.read()
#print(data)
br.select_form(nr=0)
print(br.form)
#br.form.add_file(open(ip), 'text/plain', ip, name = 'seqfile')
br['proteina'] = data
br['posizione'] = "L229F"
print(br.form)
response = br.submit()
I got the results with sample input files directly uploaded on the web tool. I am getting the web tools error "Incorrect Aminoacid Position" with the above python scripts. Please help me to solve this issue.