China Telecom Wi-Fi receiver

Source: Internet
Author: User
Tags urlencode

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.