Ryanair_Y 2016-12-23 16:16 采纳率: 0%
浏览 1017

关于python web的问题

 import httplib2

class usd():
    def __init__(self,user_id,password,k_num,k_id):
        self.user_id=user_id
        self.password=password
        self.k_num=[]
        self.k_num=k_num
        self.k_id=[]
        self.k_id=k_id

    def GetCookies(self):
        try:
            header = {
                'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
                'Accept-Encoding': 'gzip, deflate',
                'Accept-Language:zh-CN,zh': 'q=0.8',
                'Cache-Control': 'max-age=0',
                'Connection': 'keep-alive',
                'Content-Length': '26',
                'Content-Type': 'application/x-www-form-urlencoded',
                'Host': 'jwxt.imu.edu.cn',
                'Origin': 'http://jwxt.imu.edu.cn',
                'Referer': 'http://jwxt.imu.edu.cn/',
                'Upgrade-Insecure-Requests': '1',
                'User - Agent': ' Mozilla / 5.0(Windows NT 10.0; Win64; x64) AppleWebKit / 537.36(KHTML, likeGecko) Chrome / 55.0.2883.75Safari / 537.36'
            }
            link = httplib2.Http()
            content,response=link.request("http://jwxt.imu.edu.cn/loginAction.do?zjh="+self.user_id+"&mm="+self.password,"GET",header)
            data=str(response.decode("gb2321")).replace(" ","")
            if "不正确" in data or "你输入的证件号不存在" in data:
                return "login fail"
            else :
                print(content)
                return "login succeed"

        except Exception as f:
            print(f)
            return "login fail"





#  control this class to achieve selecting courses

def main():
    k_num=[]
    k_id=[]
    user_id="0161123434"
    password=""
    w=usd(user_id,password,k_num,k_id)
    data=w.GetCookies()
    print(data)








出现了C:\Users\ASUS\AppData\Local\Programs\Python\Python35\python.exe C:/Users/ASUS/PycharmProjects/untitled1/tests.py

Process finished with exit code 0
问题是怎么回事,新手不懂求解

  • 写回答

2条回答 默认 最新

  • devmiao 2016-12-23 16:48
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?