[Python] Scraping data using Network, Fetch, Response

Discussão em 'Python' iniciado por Stack, Agosto 26, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to scrape the data from the website "https://kgis.ksrsac.in/election/AssemblyEng.aspx?Asmbcd=94" where "Asmbcd=" varies from 1 to 200.

    Particularly I want to get the candidates' data for the 2018 Vote details. I could see the data source at Network -> Fethch/XHR -> Response.

    I am fairly new to scraping so any help would be very helpful:

    import requests
    from bs4 import BeautifulSoup

    url = "https://kgis.ksrsac.in/election/Election.asmx/GetPollingStationCandidateVotes"
    response = requests.get(url)

    soup = BeautifulSoup(response.content, "html.parser")
    table = soup.find("table", {"id": "GridData"})

    rows = table.find_all("tr")
    for row in rows:
    cells = row.find_all("td")
    if len(cells) == 3:
    candidate = cells[0].text.strip()
    party = cells[1].text.strip()
    votes = cells[2].text.strip()
    print(candidate, party, votes)

    Continue reading...

Compartilhe esta Página