Green Maps Comparison with Elections Database
This page shows the difference between candidates in the elections database, and on Green Maps. If you are logged in, the results were generated just now.
COULD NOT DISPLAY THAT PAGE.
HERE IS THE ERROR MESSAGE:
'RootPage' object has no attribute 'politicians' - Expression: "python import requests from bs4 import BeautifulSoup from slugify import slugify url = "https://www.gpelections.org" response = requests.get(url) data = response.text soup = BeautifulSoup(data, 'html.parser') records = soup.find_all('tr') root = view.getSiteRoot() politicians = root.politicians results = [] for row in records[1:]: cells = row.find_all('td') theRow = [] for td in cells: theRow.append (td.text) if len(cells) >=2: link = cells[2].contents[0] if getattr(link,'name') == 'a': theRow.append (link['href']) won = row.find_all('img') if (len(won)>0): theRow.append("won") else: theRow.append("lost") if theRow[0] =='11/08/2022': results.append(theRow) theirs = {} for item in results: theirs[slugify(item[2])] = item needed = [] for item in results: slug = slugify (item[2]) if slug in politicians and hasattr(politicians[slug],'candidateInfo'): continue needed.append(item) gpNeeds =[] for key, value in politicians.items(): if value.isCandidate(): if not key in theirs: gpNeeds.append(value) def key(item" - Filename: comparison-with-elections-database/content - Location: (line 7: col 2) - Arguments: context:
request:
view:
target_language:
repeat:
url: https://www.gpelections.org
response:
data: \n\n\n
records:
root:
'RootPage' object has no attribute 'politicians' - Expression: "python import requests from bs4 import BeautifulSoup from slugify import slugify url = "https://www.gpelections.org" response = requests.get(url) data = response.text soup = BeautifulSoup(data, 'html.parser') records = soup.find_all('tr') root = view.getSiteRoot() politicians = root.politicians results = [] for row in records[1:]: cells = row.find_all('td') theRow = [] for td in cells: theRow.append (td.text) if len(cells) >=2: link = cells[2].contents[0] if getattr(link,'name') == 'a': theRow.append (link['href']) won = row.find_all('img') if (len(won)>0): theRow.append("won") else: theRow.append("lost") if theRow[0] =='11/08/2022': results.append(theRow) theirs = {} for item in results: theirs[slugify(item[2])] = item needed = [] for item in results: slug = slugify (item[2]) if slug in politicians and hasattr(politicians[slug],'candidateInfo'): continue needed.append(item) gpNeeds =[] for key, value in politicians.items(): if value.isCandidate(): if not key in theirs: gpNeeds.append(value) def key(item" - Filename: comparison-with-elections-database/content - Location: (line 7: col 2) - Arguments: context: