import urllib,urllib2,cookielib
loginurl="http://192.168.1.80/login.htm"
cj = cookielib.CookieJar()
opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36",
"Connection": "keep-alive",
"Host": "192.168.1.80",
"Referer": "http://192.168.1.80/firstpage.htm",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
}
for key in headers:
opener.addheaders.append((key,headers[key]))
data = urllib.urlencode({"log_in":"00000000","submit":""})
opener.open(loginurl,data)
keep reporting: BadStatusLine: error, God, ask how to deal with ~