Example #1
0
    def wrapper(*args, **kwargs):
        grab = Grab(debug_post=True, log_dir='../log')

        ## load grab instance
        config = {}  # config = {} # config = User.grab_config
        try:
            grab.load_config(config)
        except Exception:
            logging.debug("Configuration is empty!")
            # login()

        ## check login
        email = ''  # User.email
        password = ''  #User.password
        if not grab.cookies.cookiejar:
            if not login(grab, email, password):
                logging.error("ERROR! Not authorised")
                return
            logging.debug("Successfully logged in")
            config = grab.dump_config()
        logging.debug("Session restored successfully")

        return func(grab=grab, *args, **kwargs)