Skip to content

Instantly share code, notes, and snippets.

@cjwinchester
Created July 6, 2021 18:18
Show Gist options
  • Save cjwinchester/5ce705eaa1bc5e0ef463bca5d1d8dc2c to your computer and use it in GitHub Desktop.
Save cjwinchester/5ce705eaa1bc5e0ef463bca5d1d8dc2c to your computer and use it in GitHub Desktop.
Download a CSV of the Illinois SOR.
from datetime import date
from playwright.sync_api import sync_playwright
today = date.today().isoformat()
filename = f'il-sex-offenders-{today}.csv'
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
context = browser.new_context(accept_downloads=True)
page = context.new_page()
page.goto('https://isp.illinois.gov/Sor/Disclaimer')
page.click('button[value="Agree"]')
with page.expect_download() as download_info:
page.click('input#downloadall')
download = download_info.value
download.save_as(filename)
path = download.path()
browser.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment