Good afternoon,
I have a problem that is already giving a certain headache. The blessed payload of the request is not being sent to the webservice, only to the url.
My code looks 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 at all, that is, it is only sent to the url and the parameters are not. Does anyone know why this is happening? My Python version is 3.7