-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.py
More file actions
26 lines (20 loc) · 837 Bytes
/
notification.py
File metadata and controls
26 lines (20 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import requests
import certifi
class notitic
def send_pushover_notification(user_key, api_token, message):
url = 'https://api.pushover.net/1/messages.json'
payload = {
'token': api_token,
'user': user_key,
'message': message
}
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
# Sending the POST request with SSL certificate verification enabled
response = requests.post(url, data=payload, headers=headers, verify=certifi.where())
return response.json() # Return the JSON response from Pushover
# Example usage
api_token = 'a6v5rk5g8j3hi9x84axhkupojc5msf' # Your API Token
user_key = 'ujw4rnukf4xtr8bq81gapwc13brdqd' # Your User Key
message = 'Damn daniel is so sexy !'
response = send_pushover_notification(user_key, api_token, message)
print(response)