import requests
import time

IPADDR = '10.6.10.162'

def http_command(command,ipaddr=IPADDR):
    req = 'http://{0}/{1}'.format(IPADDR, command)
    print(req)
    r = requests.get(req)
    print(r.status_code)
    print(r.text)
    print()
    return r

http_command('ctrl/mode?action=query')
http_command('ctrl/mode?action=to_rec')
http_command('ctrl/rec?action=remain')
http_command('ctrl/rec?action=stop')
http_command('ctrl/stream_setting?index=stream1&width=640&height=480&bitrate=500000&fps=30')
#http_command('ctrl/rec?action=start')
#http_command('ctrl/rec?action=start')
#time.sleep(1)
#http_command('ctrl/rec?action=stop')

print('done')

