From ff9c1fbd3b3ef9af09c2d770c385c53a5e274320 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Sat, 19 Oct 2024 18:44:12 +0530 Subject: [PATCH] Moved requests test to archive. --- Archive/requests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Archive/requests.py diff --git a/Archive/requests.py b/Archive/requests.py new file mode 100644 index 0000000..5f16d9c --- /dev/null +++ b/Archive/requests.py @@ -0,0 +1,22 @@ +import requests + +# Function to send notification using notify.sh +def send_notification(): + url = "http://:/notify" # Replace with your Raspberry Pi's IP and port + payload = { + "title": "Motion Detected!", + "message": "Motion has been detected by the camera." + } + headers = { + "Authorization": "Bearer " # Replace with your API token + } + + try: + response = requests.post(url, json=payload, headers=headers) + if response.status_code == 200: + print("Notification sent successfully!") + else: + print("Failed to send notification:", response.status_code, response.text) + except Exception as e: + print("Error sending notification:", e) +