Spaces:
Sleeping
Sleeping
| 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]} | |