import requests def send_sms_via_diafaan(): # Diafaan SMS Server configuration server_url = "http://localhost:9710/http/send-message" # Replace with your server address username = "admin" # Replace with your Diafaan username password = "" # Replace with your Diafaan password # SMS details to_number = "420775735276" # Recipient number with country code message = "Hello from Python via Diafaan SMS Server!" sender_id = "" # Optional sender ID # Prepare the request parameters params = { 'username': username, 'password': password, 'to': to_number, 'message': message, 'from': sender_id } try: # Send the HTTP GET request response = requests.get(server_url, params=params) # Check the response if response.status_code == 200: print("SMS sent successfully!") print("Response:", response.text) else: print(f"Failed to send SMS. Status code: {response.status_code}") print("Response:", response.text) except Exception as e: print(f"An error occurred: {str(e)}") # Call the function send_sms_via_diafaan()