Kratzerdaten mithilfe von Netzwerk, Fetch, AntwortPython

Python-Programme
Anonymous
 Kratzerdaten mithilfe von Netzwerk, Fetch, Antwort

Post by Anonymous »

Ich versuche, die Daten von der Website "https://kgis.ksrsac.in/election/assembl ... ?asmbcd=94" zu kratzen, wobei "asmbcd =" variiert von 1 bis 200. Fethch/XHR -> Antwort sehen.

Code: Select all

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)

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post