Skip to content

Commit

Permalink
Patch DC for #596 with linting
Browse files Browse the repository at this point in the history
  • Loading branch information
stucka authored Jan 8, 2024
1 parent 1cea6ea commit c9c4e1a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions warn/scrapers/dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def scrape(
today = datetime.today()
current_year = today.year
targetfile = f"dc/{current_year}.html"
if not cache.exists(targetfile): # Check if we have an entry for the latest year
if not cache.exists(targetfile): # Check if we have an entry for the latest year
url = f"https://does.dc.gov/page/industry-closings-and-layoffs-warn-notifications-{current_year}"
r = requests.head(url)
if not r.ok:
logger.debug(f"Still no data found for {current_year}. Falling back.")
current_year = today.year - 1
targetfile = f"dc/{current_year}.html"
url = f"https://does.dc.gov/page/industry-closings-and-layoffs-warn-notifications-{current_year}"

r = utils.get_url(url)
r.encoding = "utf-8"
root_html = r.text
Expand Down Expand Up @@ -80,7 +80,6 @@ def scrape(
root_html,
]
for href in link_lookup.values():

# Request the HTML
r = utils.get_url(href)
r.encoding = "utf-8"
Expand Down

0 comments on commit c9c4e1a

Please sign in to comment.