I have a motor controller that runs a REST web service which I want to control using Python.
I am able to successfully perform GET requests using the Python requests library. I am however not able to perform POST requests. It gives me the following error:
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))I suspect that the web service crashes because I sometimes have to restart the motor controller to get GET requests working again. Here is the python code I am using to perform the POST:
import requestsurl = 'http://192.168.178.199/od/607A/00'headers = {'Content-Type': 'application/x-www-form-urlencoded'}data = '00000002'response = requests.post(url, headers=headers, data=data)print(response.content)I am however able to successfully perform POST requests using the following Curl command:
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -i 'http://192.168.178.199/od/607A/00' --data '"00000003"'HTTP/1.0 200 OKServer: uip/1.0Cache-Control: no-cache, no-store, privateContent-type: application/jsonThe python code should be exactly the same right? What am I missing?
FYI: The motor controller I am using is a nanotec n5-2-3. Manual with info on the REST service can be found here:https://en.nanotec.com/fileadmin/files/Handbuecher/Handbuecher_Archiv/Steuerungen/N5/fir-v2039/N5_EtherNetIP_Technical-Manual_V3.2.0.pdf