Exemplo n.º 1
0
def make_lasc_search():
    """Create a logged-in LASCSearch object with cookies pulled from cache

    :return: LASCSearch object
    """
    r = make_redis_interface('CACHE')
    session = LASCSession()
    session.cookies = pickle.loads(r.get(LASC_SESSION_COOKIE_KEY))
    return LASCSearch(session)
Exemplo n.º 2
0
def login_to_court():
    """Set the login cookies in redis for an LASC user

    Replace any existing cookies in redis.

    :return: None
    """
    r = make_redis_interface("CACHE")
    # Give yourself a few minutes to log in
    r.set(LASC_SESSION_STATUS_KEY, SESSION_IS.LOGGING_IN, ex=60 * 2)
    lasc_session = LASCSession(username=LASC_USERNAME, password=LASC_PASSWORD)
    lasc_session.login()
    cookie_str = str(pickle.dumps(lasc_session.cookies))
    # Done logging in; save the cookies.
    r.set(LASC_SESSION_COOKIE_KEY, cookie_str, ex=60 * 30)
    r.set(LASC_SESSION_STATUS_KEY, SESSION_IS.OK, ex=60 * 30)