Download backend/tools/weather_tool.py from build-small-hackathon/elysium: direct link, hf CLI and curl.
- Browser
- Download file 337 Bytes
-
https://huggingface.co/spaces/build-small-hackathon/elysium/resolve/4fe2c5589b5b0062e15d147d4902c970210e2fbf/backend/tools/weather_tool.py
- Command line
-
hf download hf://spaces/build-small-hackathon/elysium@4fe2c5589b5b0062e15d147d4902c970210e2fbf/backend/tools/weather_tool.py
-
curl -L -o weather_tool.py https://huggingface.co/spaces/build-small-hackathon/elysium/resolve/4fe2c5589b5b0062e15d147d4902c970210e2fbf/backend/tools/weather_tool.py
337 Bytes
| import httpx | |
| def run(params: dict) -> dict: | |
| loc = params.get("location", "") | |
| try: | |
| r = httpx.get(f"https://wttr.in/{loc}?format=j1", timeout=10) | |
| return {"status": "ok", "location": loc, "data": r.json()} | |
| except Exception as e: | |
| return {"status": "offline", "error": str(e), "location": loc} | |