I have 2 django server. I want to send some POST data from the server A to server B.
I use this code on server A to send data (I simply follow the tutorial ) :
payload = {"contenu" : Contenu, "ID" : hashage} payload_json = json.dumps(payload, separators=(',', ': ')) with open('backend/config.json') as json_data: facto = json.load(json_data) json_data.close hostnamefacto = facto["Factory"]["IP"] portFacto = facto["Factory"]["port"] reponse = requests.post('http://'+hostnamefacto+':'+portFacto+'/outil/test/', data = payload_json) On server B, I use this code to get data :
try: contenu = request.POST['contenu'] except KeyError: contenu = None try: ID = request.POST['ID'] except KeyError: ID = None But ID and contenu are equal None. Does someone have an idea of how to do it ? Thanks a lot.