I want to parse data from a website after submitting a form and I'm using requests library to do that.
This is the website. There is a form on that site. after submitting the form the page reloads and it generates a new table that contains the information, and that's the information I want.
This the header when I manually submit the form:
activeFormName:report_builder_form
repProviance:66
repStation:40754
parameters:1
start_year:1951
end_year:1963
SearchBtn:جستجو
SearchBtn:جستجو
__sisReportRowCount:10
__sisReportParamType:simple`
I send post request using a dictionary of data:
import requests
from bs4 import BeautifulSoup
form_data = {
'activeFormName':'report_builder_form',
"repProviance": 66,
'repStation': 40754,
'parameters':1 ,
"start_year": 1951,
"end_year": 1963,
"SearchBtn":"%D8%AC%D8%B3%D8%AA%D8%AC%D9%88",
# "SearchBtn":"جستجو", ### This line and above are the same.
"__sisReportParamType": 'simple',
"__sisReportRowCount": 10
}
respones = requests.post(url,data=form_data)
s = BeautifulSoup(respones.content,'lxml')
but it always gives me an HTML file that contains no information.