# Path: mod/_config.py

# 
# Path: mod/models/phylab_cache.py
# class PhylabCache(Base):
#     __tablename__ = 'phylab'
#     cardnum = Column(Integer, primary_key=True)
#     text = Column(String(4096), nullable=False)
#     date = Column(Integer, nullable=False)


from .._config import phylabCacheTime
from config import *
from tornado.httpclient import HTTPRequest, AsyncHTTPClient,HTTPClient
from BeautifulSoup import BeautifulSoup
from ..models.phylab_cache import PhylabCache
from sqlalchemy.orm.exc import NoResultFound
from time import time, localtime, strftime
import tornado.web
import tornado.gen
import urllib
import json, base64
import datetime
import traceback

                        method='GET',
                        request_timeout=TIME_OUT
                    )
                response = yield tornado.gen.Task(client.fetch, request)
                self.init_data(response.body)
                header['Cookie'] = response.headers['Set-Cookie'].split(';')[0]
                request = HTTPRequest(
                        LOGIN_URL,
                        method='POST',
                        headers = header,
                        body = urllib.urlencode(loginValues),
                        request_timeout=TIME_OUT
                    )
                response = yield tornado.gen.Task(client.fetch, request)
                header['Cookie'] += ';'+response.headers['Set-Cookie'].split(';')[0]
                self.init_select_data(header['Cookie'])
                for curNumber in curType:
                    selectData['ctl00$cphSltMain$ShowAStudentScore1$ucDdlCourseGroup$ddlCgp'] = curNumber
                    getRequest =HTTPRequest(
                            phyLabCurUrl,
                            body=urllib.urlencode(selectData),
                            method='POST',
                            headers = header,
                            request_timeout=TIME_OUT
                        )
                    getResponse = yield tornado.gen.Task(client.fetch, getRequest)
                    retjson['content'][curType.get(curNumber)] = self.getCur(getResponse.body)
	    except KeyError:
                retjson = {
                    'code':200,

# Path: mod/_config.py

# 
# Path: mod/models/phylab_cache.py
# class PhylabCache(Base):
#     __tablename__ = 'phylab'
#     cardnum = Column(Integer, primary_key=True)
#     text = Column(String(4096), nullable=False)
#     date = Column(Integer, nullable=False)


# Path: mod/phylab/handler.py
from .._config import phylabCacheTime
from config import *
from tornado.httpclient import HTTPRequest, AsyncHTTPClient,HTTPClient
from BeautifulSoup import BeautifulSoup
from ..models.phylab_cache import PhylabCache
from sqlalchemy.orm.exc import NoResultFound
from time import time, localtime, strftime
import tornado.web
import tornado.gen
import urllib
import json, base64
import datetime
import traceback

                        method='GET',
                        request_timeout=TIME_OUT
                    )
                response = yield tornado.gen.Task(client.fetch, request)
                self.init_data(response.body)
                header['Cookie'] = response.headers['Set-Cookie'].split(';')[0]
                request = HTTPRequest(
                        LOGIN_URL,
                        method='POST',
                        headers = header,
                        body = urllib.urlencode(loginValues),
                        request_timeout=TIME_OUT
                    )
                response = yield tornado.gen.Task(client.fetch, request)
                header['Cookie'] += ';'+response.headers['Set-Cookie'].split(';')[0]
                self.init_select_data(header['Cookie'])
                for curNumber in curType:
                    selectData['ctl00$cphSltMain$ShowAStudentScore1$ucDdlCourseGroup$ddlCgp'] = curNumber
                    getRequest =HTTPRequest(
                            phyLabCurUrl,
                            body=urllib.urlencode(selectData),
                            method='POST',
                            headers = header,
                            request_timeout=TIME_OUT
                        )
                    getResponse = yield tornado.gen.Task(client.fetch, getRequest)
                    retjson['content'][curType.get(curNumber)] = self.getCur(getResponse.body)
	    except KeyError:
                retjson = {
                    'code':200,

                    'content':{}
