fetching responses json
This commit is contained in:
20
generate
Executable file
20
generate
Executable 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)
|
||||
Reference in New Issue
Block a user