Beispiel #1
0
    def __init__(self, username: str, password: str):
        self.username = username
        self.password = util.get_sha256(password)

        self.__headers = {
            "Connection": "keep-alive",
            "Content-Type": "application/json",
        }

        # login the acconut
        try:
            self.login = self.__login()
        except:
            self.info = None

        # get the user info
        try:
            self.info = self.login["data"]
        except:
            self.info = None

        # update some values
        try:
            self.__headers["token"] = self.info["token"]
            self.is_logged = True
        except:
            self.is_logged = False

        # init last record info
        self.last_record = None
Beispiel #2
0
    def __init__(self, username: str, password: str):
        self.username = username
        self.password = util.get_sha256(password)

        self.__headers = {
            "Connection": "keep-alive",
            "Content-Type": "application/json",
            "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36",
        }

        # login the acconut
        try:
            self.login = self.__login()
        except:
            self.info = None

        # get the user info
        try:
            self.info = self.login["data"]
        except:
            self.info = None

        # update some values
        try:
            self.__headers["token"] = self.info["token"]
            self.is_logged = True
        except:
            self.is_logged = False

        # init last record info
        self.last_record = None
Beispiel #3
0
    def change_password(self, psw: str):
        """
        for changes your password
        """
        data = {"password": util.get_sha256(psw)}

        try:
            response = requests.put(
                url=endpoints["password"], params=data, headers=self.__headers, timeout=5
            )
        except:
            return None

        res = response.json()

        return res
Beispiel #4
0
    def __init__(self, username: str, password: str):
        self.username = username
        self.password = util.get_sha256(password)

        self.__headers = {
            'Proxy-Connection': 'keep-alive',
            'Accept': 'application/json, text/plain, */*',
            'DNT': '1',
            'User-Agent':
            'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36',
            'Content-Type':
            'application/json;charset=UTF-8;Access-Control-Allow-Headers',
            'Origin': 'http://hmgr.sec.lit.edu.cn',
            'Referer': 'http://hmgr.sec.lit.edu.cn/web/',
            'Accept-Language': 'zh-CN,zh;q=0.9',
        }

        self.__cookies = {
            # "muyun_sign_cookie": "7034bbc44c88bcb8781dae8af9e474ca"
        }

        #login the acconut
        try:
            self.__set_cookies()
            self.login = self.__login()
        except:
            self.info = None

        # get the user info
        try:
            self.info = self.login["data"]
        except:
            self.info = None

        # update some values
        try:
            self.__headers["token"] = self.info["token"]
            self.is_logged = True
        except:
            self.is_logged = False

        # init last record info
        self.last_record = None