Created
November 6, 2024 02:27
-
-
Save kerryhatcher/820c0418e71b023538fdd4fed80e0425 to your computer and use it in GitHub Desktop.
GA Election Data Grabber
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
3.10 |
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
import requests | |
from loguru import logger | |
import json | |
logger.add("hello.log", rotation="500 MB", retention="10 days", level="INFO") | |
def get_data(): | |
r = requests.get('https://results.sos.ga.gov/cdn/results/Georgia/export-2024NovGen.json') | |
logger.info(f"Status code: {r.status_code}") | |
with open('output.json', 'w') as f: | |
f.write(r.text) | |
return r.json() | |
def main(): | |
data = get_data() | |
logger.info(data) | |
print(json.dumps(data, indent=4)) | |
if __name__ == "__main__": | |
main() |
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
[project] | |
name = "vote" | |
version = "0.1.0" | |
description = "grab data from GA SOS" | |
readme = "README.md" | |
requires-python = ">=3.10" | |
dependencies = [ | |
"loguru>=0.7.2", | |
"requests>=2.32.3", | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment