Files
foodlinkk-command-center/scripts/research_refresh.py
T

16 lines
485 B
Python
Raw Normal View History

#!/usr/bin/env python3
"""Nightly research + recommendations refresh."""
import json
import urllib.request
TOOLS = "http://10.4.7.18:8700"
def post(path):
req = urllib.request.Request(f"{TOOLS}{path}", method="POST", headers={"Content-Length": "0"})
with urllib.request.urlopen(req, timeout=120) as r:
return json.loads(r.read())
if __name__ == "__main__":
print("research", post("/research/run"))
print("recommendations", post("/recommendations/generate"))