I have a moodle site up and running in my local. I have an admin account with all the privileges and also completed all the set ups [e.g enabling web service, protocol etc]. Finally I have generated a token and trying to use function '
core_course_get_courses' by a simple get request from python. But I am continuously getting "Access control exception". Is there any suggested solution or I am missing something?#Python Code
import requestsError output:
token = 'XXXXXXXXXXXXXXXXXXX'
function = 'core_course_get_courses'
url = 'http://mymoodlesite/webservice/rest/server.php?wstoken={0}&wsfunction={1}'.format(token,function)
response =requests.get(url)
print(response.status_code)
print(response.json())
<?xml version="1.0" encoding="UTF-8" ?>
<EXCEPTION class="webservice_access_exception">
<ERRORCODE>accessexception</ERRORCODE>
<MESSAGE>Access control exception</MESSAGE>
</EXCEPTION>