Skip to content

Commit

Permalink
Merge pull request #669 from biglocalnews/ri-20241008
Browse files Browse the repository at this point in the history
Patch RI
  • Loading branch information
stucka authored Oct 8, 2024
2 parents 4a2467d + d3bbf9d commit 18a3066
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions warn/scrapers/ri.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def scrape(
dirty_list.extend(localrows)

headers = dirty_list[1] # Skip false header at position 0
headers = [x for x in headers if x is not None]
headers[2] = (
headers[2]
.replace("Company Name ", "Company Name")
Expand All @@ -85,9 +86,14 @@ def scrape(
logger.debug(f"Got : {row}")
else:
line = {}
for i, fieldname in enumerate(headers):
line[fieldname] = row[i]
row_list.append(line)
if len(headers) > len(row):
logger.debug(
f"{len(row)} items found, vs. expected {len(headers)}. Dropping row: {row}"
)
else:
for i, fieldname in enumerate(headers):
line[fieldname] = row[i]
row_list.append(line)
# dirty_list = None
logger.debug(
f"Successfully merged {len(row_list)-1:,} records from new spreadsheet."
Expand Down

0 comments on commit 18a3066

Please sign in to comment.