summaryrefslogtreecommitdiff
path: root/hosts/ahmed/forsvarsarper/script.py
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-02-20 19:00:53 +0100
committerLinnnus <[email protected]>2024-02-20 19:01:44 +0100
commit274e08f50faffe1b8e4a760811b0a12450eae719 (patch)
tree393449e81f21b6f6b1ea7a701cef0f740cc3b757 /hosts/ahmed/forsvarsarper/script.py
parent1bbdd3f63a9d8c46b1772cbf2ad9fd83d7ef213b (diff)
Merge 'reorg' into 'main'
This patch moves in the reorganizational work done on the reorg branch, mainly: * Move host-specific modules into hosts/<host>/<module> * Break up HM config See the reorg branch for the individual commits.
Diffstat (limited to 'hosts/ahmed/forsvarsarper/script.py')
-rw-r--r--hosts/ahmed/forsvarsarper/script.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/hosts/ahmed/forsvarsarper/script.py b/hosts/ahmed/forsvarsarper/script.py
new file mode 100644
index 0000000..7f12508
--- /dev/null
+++ b/hosts/ahmed/forsvarsarper/script.py
@@ -0,0 +1,28 @@
+import requests
+import os
+
+URL = "https://karriere.forsvaret.dk/varnepligt/varnepligten/cybervarnepligt/"
+TARGET_PHRASE = "Der er p&aring; nuv&aelig;rende tidspunkt ikke planlagt nogen afpr&oslash;vninger."
+
+try:
+ response = requests.get(URL);
+ print(f"Forespørgsel til {URL} gav status {response.status_code}")
+except:
+ message = "nejj den er ødelagt"
+else:
+ if TARGET_PHRASE in response.text:
+ message = "der er stadig ikke planlagt nogle afprøvninger"
+ else:
+ message = "noget har ændret sig på siden!!"
+ print(response.text)
+
+token = os.getenv("TOKEN")
+data = {
+ "title": "forsvaret status",
+ "message": message,
+ "url": URL,
+}
+response = requests.post(f"https://notifications.linus.onl/api/send-notification/{token}", json=data)
+print(f"Forespørgsel til at sende notifikation gav status {response.status_code}")
+response.raise_for_status()
+