Created
July 6, 2021 18:18
-
-
Save cjwinchester/5ce705eaa1bc5e0ef463bca5d1d8dc2c to your computer and use it in GitHub Desktop.
Download a CSV of the Illinois SOR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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