python scrape data from aspx page

Solutions on MaxInterview for python scrape data from aspx page by the best coders in the world

showing results for - "python scrape data from aspx page"
Francesco
07 Jan 2020
1#pip install requests
2#pip install lxml
3#pip install bs4
4import requests
5from bs4 import BeautifulSoup
6
7r_obj = requests.Session()
8url = "aspx_website_url_here" # i.e. http://bisegrw.edu.pk/
9r_soup = r_obj.get(url)
10soup = BeautifulSoup(r_soup.content , "lxml")
11
12hidden_inputs = soup.find_all("input",type="hidden")
13
14data = {
15hidden_inputs[0]['name']:hidden_inputs[0]['value'],
16hidden_inputs[1]['name']:hidden_inputs[1]['value'],
17hidden_inputs[2]['name']:hidden_inputs[2]['value'],
18'other_input':'value',  # i.e. 'rno':'487431',
19'submitButton':'submit'}
20
21url_needed = "aspx_endpoint" # i.e. http://bisegrw.edu.pk/result-card-matric.html
22final = r_obj.post(url_needed,verify=False,data=data)
23soup1 = BeautifulSoup(final.content,"lxml")
24detail_tab = soup1.find_all("table")
25