Skip to content

Instantly share code, notes, and snippets.

@0xjmux
Created November 15, 2024 18:09

Revisions

  1. 0xjmux created this gist Nov 15, 2024.
    12 changes: 12 additions & 0 deletions python_discord_6_lines.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    import requests
    # Also see: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks

    USERNAME = "Python Notifier"
    WEBHOOK_URL = ""

    def send_alert(contents: str):
    data = {"content": contents, "username": USERNAME}
    try:
    requests.post(WEBHOOK_URL, json=data)
    except Exception as e:
    print(f"Error sending alert: {e}")