fetching responses json

This commit is contained in:
Hazel Noack
2025-07-28 15:29:17 +02:00
parent 29098500e2
commit be024389ba
3 changed files with 162 additions and 0 deletions

20
generate Executable file
View File

@@ -0,0 +1,20 @@
#!/home/fname/Projects/OpenSource/python-mommy-venv/.venv/bin/python3
import requests
from pathlib import Path
import json
CARGO_MOMMY_DATA = "https://raw.githubusercontent.com/diamondburned/go-mommy/refs/heads/main/responses.json"
MODULE_PATH = Path("python_mommy_venv")
if __name__ == "__main__":
print("generating stuff")
res = requests.get(CARGO_MOMMY_DATA)
if not res.ok:
raise Exception(f"couldn't fetch {CARGO_MOMMY_DATA} ({res.status_code})")
print(f"writing {Path(MODULE_PATH, 'responses.json')}")
with Path(MODULE_PATH, "responses.json").open("w") as f:
json.dump(res.json(), f, indent=4)