Ejemplo n.º 1
0
import json
import requests
from .tool import access_logger, logger, gen_fingerprint, parseAcceptLanguage, get_current_timestamp, timestamp_after_timestamp
from .jwt import JWTUtil, JWTException
from .aes_cbc import CBC
from libs.base import ServiceBase
from urllib import urlencode
from functools import wraps
from flask import g, request, redirect, url_for, make_response, abort, jsonify, flash
from werkzeug import url_decode
from config import SYSTEM, VAPTCHA
from vaptchasdk import vaptcha as pyvaptcha

jwt = JWTUtil()
cbc = CBC()
sbs = ServiceBase()


def get_referrer_url():
    """获取上一页地址"""
    if request.referrer and request.referrer.startswith(
            request.host_url
    ) and request.endpoint and not "api." in request.endpoint:
        url = request.referrer
    else:
        url = None
    return url


def get_redirect_url(endpoint="front.signIn"):
    """获取重定向地址
Ejemplo n.º 2
0
"""
    EauDouce.cli
    ~~~~~~~~~~~~~~

    Cli Entrance

    :copyright: (c) 2018 by Mr.tao.
    :license: MIT, see LICENSE for more details.
"""

import os
import json
from libs.base import ServiceBase
from utils.tool import logger, get_current_timestamp, timestamp_after_timestamp

_sb = ServiceBase()
basedir = os.path.dirname(os.path.abspath(__file__))


def execute_cleanCrawlHuaban():
    """执行清理花瓣网插件目录下过期的压缩文件"""
    huabandir = os.path.join(basedir, "plugins", "CrawlHuaban")
    for root in os.listdir(huabandir):
        board_id, root = root, os.path.join(huabandir, root)
        if os.path.isdir(root):
            # 判断是否锁目录中
            lock = False
            if os.path.exists(os.path.join(root, "board.lock")):
                lock = True
                logger.cli.info("Locking for {}".format(root))
            for f in os.listdir(root):