python 自动提醒黑龙江招生信息网考研成绩 小程序

本人报考哈工大计算机专业,因为成绩公示未公布明确的查询时间,心慌之下写了小的查询程序。

注:1. 在弹窗提示的手段里,可以自己填写,简单的如弹出记事本,复杂的如直接弹出web(需要提前安装selenium库)

2. header里的cookies要改成自己的,我这里隐藏为****


import requests
import selenium
import re
import os
import time

def chaxun():

    headers={"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding":"gzip, deflate, sdch",
"Accept-Language":"zh-CN,zh;q=0.8",
"Cache-Control":"max-age=0",
"Connection":"keep-alive",
"Cookie":"***********************",
"Host":"221.207.246.181:8006",
"Upgrade-Insecure-Requests":"1",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"}
    content=requests.get("http://221.207.246.181:8006/JWWebCXZX/examTypeList",headers=headers)
    content=content.content.decode("utf-8")
    flag=re.findall(r"2018.*初试",content)

    return len(flag) == 1

def tanchu():
    while True:
        f=chaxun()
        if f:
            os.system("notepad")
            #如果配置过selenium库,则可以直接使用下面代码打开浏览器
            #from selenium import webdriver
            #browser = webdriver.Firefox()
            #browser.get("http://221.207.246.181:8006/JWWebCXZX/examTypeList")
            print("出成绩啦")
            break
        else:
            print("暂未出成绩")
        time.sleep(3)
tanchu()



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章