26 lines
697 B
Python
26 lines
697 B
Python
import httpx as h
|
|
import os
|
|
import socket
|
|
|
|
RECIPIENT = os.getenv("RECIPIENT", "DEV")
|
|
|
|
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
|
s.connect(('8.8.8.8', 80))
|
|
(addr, port) = s.getsockname()
|
|
IPS = addr
|
|
|
|
def notify_status(status):
|
|
data = f"Status: {status}\nIP: {IPS}"
|
|
|
|
headers = {
|
|
"Title" : f"Eink - {RECIPIENT}",
|
|
# "Click": "https://home.nest.com/",
|
|
# "Attach": "https://nest.com/view/yAxkasd.jpg",
|
|
# "Actions": "http, Open door, https://api.nest.com/open/yAxkasd, clear=true",
|
|
# "Email": "phil@example.com"
|
|
}
|
|
h.post(
|
|
"https://ntfy.kluster.moll.re/eink",
|
|
data=data,
|
|
headers=headers
|
|
) |