How do i extract the required data from the output and save it to a variable
this is my program:
import commands
cmd = curl -v -k -H "Content-Type: application/json" -X GET -u hitman:hitman <https://test.com:8181/v1/config/sipregistrar
result = commands.getoutput(cmd)
print result
now run the programm :
python test25.py
output :
About to connect() to test.com port 8181 (#0)
Trying test.com... % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected
Connected to 50.50.50.201 (50.50.50.201) port 8181 (#0)
successfully set certificate verify locations:
HTTP/1.1 200 OK
Date: Tue, 05 Jun 2012 18:27:11 GMT
Server: Jetty(6.1.22)
Content-Type: application/json;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=12buplms5odzt;Path=/config
Transfer-Encoding: chunked
Closing connection #0
SSLv3, TLS alert, Client hello (1):
} [data not shown]
{"sip_domains":{"prefix":[{"name":""}],"domain":[{"name":"k200.com"},{"name":"zinga.com"},{"name":"rambo.com"}]},"sip_security":{"level":2},"sip_trusted_hosts":{"host":[]},"sip_proxy_mode":{"handle_requests":1}}
from this output , the params i require :
{"sip_domains":{"prefix":[{"name":""}],"domain":[{"name":"k200.com"},{"name":"zinga.com"},{"name":"rambo.com"}]},"sip_security":{"level":2},"sip_trusted_hosts":{"host":[]},"sip_proxy_mode":{"handle_requests":1}}
How do i extract the above and save it to a variable ?