Spaces:
Sleeping
Sleeping
Download note_client.py from Corin1998/PR_IRminiSaaS: direct link, hf CLI and curl.
- Browser
- Download file 616 Bytes
-
https://huggingface.co/spaces/Corin1998/PR_IRminiSaaS/resolve/main/note_client.py
- Command line
-
hf download hf://spaces/Corin1998/PR_IRminiSaaS/note_client.py
-
curl -L -o note_client.py https://huggingface.co/spaces/Corin1998/PR_IRminiSaaS/resolve/main/note_client.py
616 Bytes
| import os | |
| import requests | |
| def post_to_note(title: str, body_md: str): | |
| """ | |
| MVPでは Zapier/IFTTT 等の Webhook に Markdown を渡す想定。 | |
| NOTE_WEBHOOK_URL が未設定なら安全にスキップします。 | |
| """ | |
| url = os.getenv("NOTE_WEBHOOK_URL", "") | |
| if not url: | |
| return {"status": "skipped", "reason": "NOTE_WEBHOOK_URL not set"} | |
| try: | |
| r = requests.post(url, json={"title": title, "content_md": body_md}, timeout=20) | |
| return {"status": r.status_code, "resp": r.text[:200]} | |
| except Exception as e: | |
| return {"status": "error", "reason": str(e)[:200]} | |