Last active
February 19, 2020 20:48
-
-
Save gordonje/b0417948fa6483016463d10af38a669e to your computer and use it in GitHub Desktop.
A scraping script that runs as a single, synchronous process.
This file contains 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
import requests | |
from time import sleep | |
session = requests.Session() | |
def cache_page(identifier): | |
sleep(3) | |
url = f'https://mycourts.in.gov/PORP/Search/Detail?ID={identifier}' | |
r = session.get(url) | |
html = r.content | |
with open(f".cache/SearchDetail/{identifier}.html", 'wb') as file: | |
file.write(html) | |
return print(f' Cached content from {url}') | |
if __name__ == "__main__": | |
for identifier in range(1, 60000): | |
cache_page(identifier) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment