代碼如下:
def main():
tornado.options.parse_command_line()
application = tornado.web.Application([
(r"/", MainHandler),
(r"/mibuy/", MiBuyHandler),
],**settings)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
代碼如下:
post_data = urllib.urlencode({'passToken':'', 'user': 'www.nowamagic.net', 'pwd': 'password', 'callback':'https://account.xiaomi.com', 'sid':'passport', 'qs':'%3Fsid%3Dpassport', 'hidden':'', '_sign':'KKkRvCpZoDC+gLdeyOsdMhwV0Xg='})
path = 'https://account.xiaomi.com/pass/serviceLoginAuth2'
代碼如下:
class MiBuyHandler(tornado.web.RequestHandler):
def get(self):
cj = cookielib.CookieJar()
post_data = urllib.urlencode({'passToken':'', 'user': 'www.nowamagic.net', 'pwd': 'password', 'callback':'https://account.xiaomi.com', 'sid':'passport', 'qs':'%3Fsid%3Dpassport', 'hidden':'', '_sign':'KKkRvCpZoDC+gLdeyOsdMhwV0Xg='})
path = 'https://account.xiaomi.com/pass/serviceLoginAuth2'
cookieHandle = urllib2.HTTPCookieProcessor(cj)
opener = urllib2.build_opener(cookieHandle)
#opener.addheaders = [('User-agent', 'Opera/9.23')]
urllib2.install_opener(opener)
req = urllib2.Request(path, post_data)
response = urllib2.urlopen(req)
html = response.read()
self.render("mibuy.html",message=html)
代碼如下:
hdcontrol(
{
stime: 1383645496,
status: {
allow: true,
miphone: {
hdurl: "",
duration: null,
hdstop: true,
reg: true,
pmstart: false,
hdstart: false
},
mibox: {
hdurl: "",
duration: null,
hdstop: true,
reg: true,
pmstart: false,
hdstart: false
},
mitv: {
hdurl: "",
duration: null,
hdstop: true,
reg: false,
pmstart: false,
hdstart: false
}
}
})
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com