I recently bought a China Telecom Wi-Fi service. It is quite useful to pay 11 yuan a month for 200 hours. It is a bit uncomfortable that it will automatically lose line every two hours. You need to open the login page of China Telecom and log on again. I looked at the code on the login page and wrote it in Javascript. I watched Js for two hours at noon, and then I could understand it. Then, I found information about logging on to the python webpage on the Internet. In fact, I didn't understand it, but I wrote down the ghost.
#!/usr/bin/python2.7# -*- coding: GB2312 -*-from urllib import urlencodeimport cookielib, urllib2# cookiecj = cookielib.LWPCookieJar()opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))urllib2.install_opener(opener)# Loginuser_data = {'userName': '×××××××××××@cw.-2.chntel.com', 'password': '××××××××', 'sendType': '1' }url_data = urlencode(user_data)login_r = opener.open('http://202.103.194.221:8080/hwssp/login.do', url_data)
This is my code for logging on to Gui. I have not tried it in other places. When you are free, you can add a timing function. Two hundred hours per month. If you use more than hours, you have to pay for it.
PS: The above version is python2.7, and the following version is python3.2.
#!/usr/bin/pythonfrom urllib.parse import urlencodeimport http.cookiejar, urllib.request, urllib.error, urllib.parse# cookiecj = http.cookiejar.LWPCookieJar()opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))urllib.request.install_opener(opener)# Loginuser_data = {'userName': '×××××××××××@cw.-2.chntel.com','password': '××××××××','sendType': '1'}url_data = urlencode(user_data)binary_data = url_data.encode('ascii')login_r = opener.open('http://202.103.194.221:8080/hwssp/login.do', binary_data)#print(login_r.read())
My blog