Exemplo n.º 1
0
    def get_userinfo(self):

        req = pm.simple_req(
            'http://ecampus.sysu.edu.cn/zsuyy/application/desktop.jsp')
        html = self.opener.open(req).read().decode('gbk')

        return he.find_userinfo(html)
Exemplo n.º 2
0
    def get_field_detail(self, kind='schedule', page=1):
        """ 查询场地的详情

        :param kind: `applies`表示场地申请情况,`schedule`表示场地占用情况即已经通过审批的申请,传入一个错误的值会返回场地的占用情况
        :param page: 此参数在kind=`applies`时才需要使用,一页有10条记录,而场地占用会直接将所有占用记录返回
        :returns: `result` - 一个包含多个字典的列表,每个字典是一条记录

        """
        identified_url = he.find_identified_url(
            self.opener.open(pm.simple_req(
                'http://ecampus.sysu.edu.cn/zsuoa/'\
                        'application/oa/hc/redirect.jsp?method=' + kind
            )).read()
        )
        ts_url = he.find_ts_url(
            self.opener.open(pm.simple_req(identified_url)).read(), kind, page)

        req = pm.simple_req(ts_url)
        html = self.opener.open(req).read().decode('gbk')

        result = he.find_field_detail(html, kind)
Exemplo n.º 3
0
    def login(self, username, password):

        self.opener.open(
            pm.simple_req('http://ecampus.sysu.edu.cn/zsuyy/login_normal.jsp'))
        self.opener.open(pm.login_req(username, password))