У меня есть контроллер двигателя, на котором запущен веб-сервис REST, которым я хочу управлять с помощью Python.
Я могу успешно выполнять запросы GET, используя библиотеку запросов Python. Однако я не могу выполнять запросы POST. Выдает следующую ошибку:
Код: Выделить всё
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Код: Выделить всё
import requests
url = '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)
Код: Выделить всё
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 OK
Server: uip/1.0
Cache-Control: no-cache, no-store, private
Content-type: application/json
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/ ... V3.2.0.pdf
Источник: https://stackoverflow.com/questions/759 ... controller