- Code: Select all
yourIPnumber= "192.168.x.y"
yourCamId ="zzz"
yourCamPwd="aaaaa"
yourWifiPwd="bbbbb"
yourWifiSID="abcdef"
#get general parameters
curlCmd= "http://"+yourIPnumber+"/get_params.cgi?user="+yourCamId+"&pwd="+yourCamPwd
#get camaera parameters
curlCmd= "http://"+yourIPnumber+"/get_camera_params.cgi?user="+yourCamId+"&pwd="+yourCamPwd"
#set network parameters
curlCmd= "http://"+yourIPnumber+"/set_network.cgi?next_url=rebootme.htm&user="+yourCamId+"&pwd="+yourCamPwd+"&ip=192.168.1.75&mask=255.255.255.0&gateway=192.168.1.6&dns=192.168.1.6&port=80"
#set userid paramters
curlCmd= "http://"+yourIPnumber+"/set_users.cgi?user=admin&pwd=457654bB&user1="+yourCamId+"&pwd1="+yourCamPwd+"&pri1=2&user2=&pwd2=&pri2=0&user3=&pwd3=&pri3=0&user4=&pwd4=&pri4=0&user5=&pwd5=&pri5=0&user6=&pwd6=&pri6=0&user7=&pwd7=&pri7=0&user8=&pwd8=&pri8=0"
#set wifi parameters:
curlCmd= "http://"+yourIPnumber+"/set_wifi.cgi?user="+yourCamId+"&pwd="+yourCamPwd+"&next_url=rebootme.htm&channel=5&enable=1&ssid="+yourWifiSID+"&mode=0&encrypt=4&authtype=0&keyformat=0&defkey=0&key1=&key2=&key3=&key4=&key1_bits=0&key2_bits=0&key3_bits=0&key4_bits=0&wpa_psk="+yourWifiPwd+"&country=1"
#get video stream
curlCmd= "http://"+yourIPnumber+"/videostream.cgi?user="+yourCamId+"&pwd="+yourCamPwd
#then execute curl in python for each desired curlCmd
import subprocess
response= subprocess.Popen("/usr/bin/curl --max-time 5 '"+curlCmd+"'",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
or simply in a terminal window
curl with one of the curl commands with userid, pwd and IP replaced with the real values
Karl