Alle im Anhang ersichtlichen Dateien wurden selbst erstellt und getestet. Sie dienen dem nutzen des Raspberry-Pi Projekts des HS25 CDS Computer-Sciences Moduls.
15 lines
399 B
Python
15 lines
399 B
Python
import requests
|
|
|
|
TELEGRAM_BOT_TOKEN = "8295131851:AAEGTotKaTzIvAxqxcNYk90zNOFx12vVNfk"
|
|
TELEGRAM_CHAT_ID = "8428261562"
|
|
|
|
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
|
data = {
|
|
"chat_id": 8428261562,
|
|
"text": "Testnachricht vom Raspberry Pi (telegram_test.py)",
|
|
}
|
|
|
|
response = requests.post(url, json=data)
|
|
print("Status", response.status_code)
|
|
print("Antwort", response.text)
|