I am new to web scraping and trying to scape the following webpage: http://www.amis.pk/Arrivalreports/Arrival%20source%20target.aspx
Here is what I have tried to access the contents from the webpage in Python. I am only trying to scrape the contents, for now, the parsing will come next.
import requests
from bs4 import BeautifulSoup
r_obj = requests.Session()
url = 'http://www.amis.pk/Arrivalreports/Arrival%20source%20target.aspx'
r_soup = r_obj.get(url)
soup = BeautifulSoup(r_soup.content,'lxml')
hidden_inputs = soup.find_all("input",type="hidden")
data = {
hidden_inputs[0]['name']:hidden_inputs[0]['value'],
hidden_inputs[1]['name']:hidden_inputs[1]['value'],
# hidden_inputs[2]['name']:hidden_inputs[2]['value'],
# hidden_inputs[3]['name']:hidden_inputs[3]['value'],
hidden_inputs[4]['name']:hidden_inputs[4]['value'],
hidden_inputs[5]['name']:hidden_inputs[5]['value'],
'allmarket$ctl00$ctl03$ctl00': 'Tomato, Potato, Onion',
'allmarket$ctl00$ctl05$ctl00': 'Lahore',
'allmarket$ctl00$ctl07$ctl00': '08/13/2021',
'allmarket$ctl00$ctl03$ctl03$ctl01': 'on',
'allmarket$ctl00$ctl03$ctl03$ctl02': 'on',
'allmarket$ctl00$ctl03$ctl03$ctl03': 'on',
'allmarket$ctl00$ctl05$ctl03$ctl01': 'on',
'allmarket$ctl04':'',
'allmarket$ctl05':'',
'allmarket$ctl06': '0',
'allmarket$ctl07': '0',
'allmarket$ctl00$ctl00': 'View Report',
}
url_needed = 'http://www.amis.pk/Arrivalreports/Arrival%20source%20target.aspx'
final = r_obj.post(url_needed,verify=False,data=data)
soup1 = BeautifulSoup(final.content,"lxml")
detail_tab = soup1.find_all("table")
After the above code is run, the detail_tab does not contain the relevant table data but only the top headers. What am I missing?