Reputation:
I have a Patch request using cURL, now i want to use this with python:
curl -X Patch -H "content-type: application/json" -d '{"activation": {"mode":"activate_immediate"},"transport_params":[{"destination_ip":"239.255.255.50","destination_port": 5004, "rtp_enabled": True, "source_ip": "192.168.10.115","source_port":"auto"}]}' http://ip:port/x-nmos/connection/v1.2/single/uuid/staged
Can anyone help me with the pyCurl equivalent or any other way i can do this using python?
Upvotes: 0
Views: 218
Reputation: 411
I advice you to use the request
lib instead of pyCurl
, as mentioned by @Z4-tier. Try:
import requests
headers = {"content-type": "application/json"}
data = {"activation": {"mode":"activate_immediate"},"transport_params":[{"destination_ip":"239.255.255.50","destination_port": 5004, "rtp_enabled": True, "source_ip": "192.168.10.115","source_port":"auto"}]}
url = "http://IP:PORT/x-nmos/connection/v1.0/single/UUID/staged"
resquest = requests.patch(url = url, data = data, headers = headers)
I couldn't complete the request because of a ip or port error. Be sure the request body is correct!
Upvotes: 1