Created
November 3, 2023 04:16
-
-
Save mkeneqa/51ef64940e995a1bb85787a1c136688d to your computer and use it in GitHub Desktop.
simple python push over implmentation
This file contains hidden or 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
import requests | |
from pushover import Pushover | |
pushover = Pushover() | |
pushover.Push("Hello World") |
This file contains hidden or 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
import requests | |
POST = "POST" | |
class Pushover: | |
def __init__(self): | |
self.APP_TOKEN = "YOUR_APP_TOKEN" | |
self.USER_KEY = "YOUR_USER_KEY" | |
self.API_BASE = "https://api.pushover.net" | |
self.HEADER = {"Content-type": "application/x-www-form-urlencoded"} | |
def Push(self, message): | |
res = requests.post("https://api.pushover.net/1/messages.json", data={ | |
"token": self.APP_TOKEN, | |
"user": self.USER_KEY, | |
"message": message | |
}) | |
if res.status_code == 200: | |
print(f"Message: [{message}], sent successfully") | |
else: | |
print(res.reason) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment