0
Good afternoon,
I’m having a problem that’s already giving me a headache. The blessed request payload is not being sent to the webservice, only the url.
My code is like this:
class Curso:
'''Resgata todas as disciplinas modelo'''
def getDisModelo(self):
config = Config()
serverUrlDisc = config.dominio + "/webservice/rest/server.php" + "?wstoken=" + \
config.alocaGrupoToken + "&wsfunction=" + "core_course_get_courses_by_field" \
+ "&moodlewsrestformat=" + config.formatoRest
params = json.dumps({'field': 'id', 'value': '31198'})
s = requests.session()
s.verify=False
response = s.post(serverUrlDisc, data=params)
disciplinasAva = response.json()
response.status_code
return disciplinasAva
What happens, I can send the request but it does not recognize the content of params in any way, IE, it is only sent the url and the parameters do not. Does anyone know why this is happening? My version of Python is 3.7
I have tried these two methods previously, but without success. I believe it is the Moodle server that is blocking the json payload. I need to find the location to change this setting.
– Sergio RBJ