Created
July 14, 2023 17:54
-
-
Save gerard/ce78ea43d44a106229c2a04cc22c486f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import subprocess | |
import requests | |
def get_webhook_url(): | |
with open("/etc/chime/webhook") as f: | |
return f.read().strip() | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--msg", required=True) | |
args = parser.parse_args() | |
s = requests.Session() | |
r = s.post( | |
get_webhook_url(), | |
json={"Content": args.msg} | |
) | |
r.raise_for_status() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment