Ajout fonction SMS avec journalisation sur develop

This commit is contained in:
2025-05-11 09:14:02 +02:00
parent 15ff1ab557
commit 787d2c3a40
3 changed files with 54 additions and 9 deletions

View File

@@ -0,0 +1,25 @@
import ovh
import os
from dotenv import load_dotenv
load_dotenv()
def envoyer_sms_ovh(message, phone_number):
client = ovh.Client(
endpoint=os.getenv("OVH_ENDPOINT"),
application_key=os.getenv("OVH_APP_KEY"),
application_secret=os.getenv("OVH_APP_SECRET"),
consumer_key=os.getenv("OVH_CONSUMER_KEY"),
)
account = os.getenv("OVH_SMS_ACCOUNT") # Nom du service SMS OVH
# Envoi du SMS
result = client.post(f'/sms/{account}/jobs',
sender='Supervision', # nom affiché sur certains téléphones
message=message,
receivers=phone_number,
priority='high',
noStopClause=True,
)
return result