import urlib,urllib2,cookielib
cj=cookielib.CookieJar()
opener =urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_url=r'http://192.168.16.22:9392/omp?cmd=get_tasks&;overrides=1'
username="admin"
password="******"
login_data=urllib.urlencode({'cmd':'login','login':username,'password':password,'text':'/omp?cmd=get_tasks&overrides=1'})
opener.addheaders= [("Content-type","application/x-www-form-urlencoded"),
("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),
("Accept-Language","zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3"),
("Accept-Encoding","gzip, deflate"),
]
myopener=opener.open(login_url,login_data)