Skip to content

Instantly share code, notes, and snippets.

@kerryhatcher
Created November 6, 2024 02:27
Show Gist options
  • Save kerryhatcher/820c0418e71b023538fdd4fed80e0425 to your computer and use it in GitHub Desktop.
Save kerryhatcher/820c0418e71b023538fdd4fed80e0425 to your computer and use it in GitHub Desktop.
GA Election Data Grabber
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()
[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