感谢各位大佬的指点,问题解决了,附上我的代码:
def modTEST():
url = 'http://192.168.1.1/cgi-bin/luci/admin/network/network/TEST'
data = {'token':(None,getToken()),
'cbi.submit':(None,'1'),
'tab.network.TEST':(None,'advanced'),
'cbid.network.TEST._fwzone':(None,'-'),
'cbid.network.TEST._fwzone.newzone':(None,''),
'cbi.cbe.network.TEST.type':(None,'1'),
'cbi.cbe.network.TEST.ifname_single':(None,'1'),
'cbid.network.TEST.ifname_single':(None,'eth0.3'),
'cbid.network.TEST.proto':(None,'dhcp'),
'cbid.network.TEST.hostname':(None,''),
'cbi.cbe.network.TEST.auto':(None,'1'),
'cbi.cbe.network.TEST.delegate':(None,'1'),
'cbid.network.TEST.delegate':(None,'1'),
'cbi.cbe.network.TEST.broadcast':(None,'1'),
'cbi.cbe.network.TEST.defaultroute':(None,'1'),
'cbid.network.TEST.defaultroute':(None,'1'),
'cbi.cbe.network.TEST.peerdns':(None,'1'),
'cbid.network.TEST.peerdns':(None,'1'),
'cbid.network.TEST.metric':(None,''),
'cbid.network.TEST.clientid':(None,''),
'cbid.network.TEST.vendorid':(None,''),
'cbid.network.TEST.macaddr':(None,'00:e0:4c:36:11:a1'),
'cbid.network.TEST.mtu':(None,''),
'cbi.apply':(None,'保存&应用')}
print(data)
res =
requests.post(url, files=data, cookies={'sysauth': cookiesValue})
print(res.request.body)
print(res.request.headers)
res.encoding = 'utf8'
print(res.text)
restartFireWall()
return