I'm trying to run bash commands from python3 script and I get an error. Command:
#!/usr/bin/python3
import os
os.system('curl -k --header "Authorization: 3NKNRNNUrFQtu4YsER6" --header "Accept: application/json" --header "Content-Type: application/json" https://192.168.1.1/alerts/index/limit:1/page:1/sort:id/direction:desc.json | jq -r ''{"request": {"alert": {"alert": .[0].alert, "new": "test"}}}'' > 1.json')
Error response:
jq: error: syntax error, unexpected $end (Unix shell quoting issues?) at
<top-level>, line 1:
{request:
(23) Failed writing body
\'requestsinstead of runningcurl.