Skip to content

Instantly share code, notes, and snippets.

@mkeneqa
Created November 3, 2023 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkeneqa/51ef64940e995a1bb85787a1c136688d to your computer and use it in GitHub Desktop.
Save mkeneqa/51ef64940e995a1bb85787a1c136688d to your computer and use it in GitHub Desktop.
simple python push over implmentation
import requests
from pushover import Pushover
pushover = Pushover()
pushover.Push("Hello World")
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