TechSmith Relay (Self-Hosted): Troubleshooting Sending Notifications to Moodle

Below is a simple Python 3.x script that can be used to troubleshoot the Moodle course announcement plug-in. To use it, you will need to:

  1. Install Python 3.0+ on a client computer.
  2. Copy the script below into a file on the client computer, e.g.,
  3. Edit serverUrl and server to match your Moodle server configuration.
  4. Run the script like something like this: C:\python31\python.exe

# For use with Python 3.x

import sys
import time
import xmlrpc.client

timestamp = time.strftime("%Y-%m-%dT%H:%M:%S") # iso_time

# Server settings

serverUrl = "http://localhost:80/"

server = "moodle199" # can be empty if the serverUrl identifies the server

service = "forum_add_discussion1"


# format and mailnow are hardcoded for now


# Announcement settings

subject="python3 test's subject " + timestamp + ", <a
message="python3 \"test's\" msg " + timestamp

# RPC call and results

rpcServerUrl = serverUrl + server + "/mnet/xmlrpc/server.php"

service = "mod/forum/rpclib.php/" + service

xmlRpcServer = xmlrpc.client.Server(rpcServerUrl)
print("*** Calling XML-RPC service {0} on server URL {1}".format(service, rpcServerUrl))

result = xmlRpcServer._ServerProxy__request(service, (courseshortname, subject, message, format, username, mailnow))

print("result =", result)

except Exception as e:

print("Unexpected error:", sys.exc_info())


See also