#!/usr/bin/env python3
# pylint: disable=invalid-name
"""Send a notification to my notification service.

Send it in a separate process so that the calling process is not hanged.
"""

import json
import os
import sys
import urllib.request


if __name__ == "__main__":
    if os.fork():
        sys.exit()
    message = " ".join(sys.argv[1:])
    data = json.dumps({"message": message}).encode()
    request = urllib.request.Request(
        "https://notify.shore.co.il/send",
        data=data,
        method="POST",
        headers={"Content-Type": "application/json"},
    )
    urllib.request.urlopen(request)  # nosec
