Skip to content

Instantly share code, notes, and snippets.

View awanabe's full-sized avatar
🎯
Focusing

SimoChao awanabe

🎯
Focusing
  • 上海, 杨浦
View GitHub Profile
@awanabe
awanabe / BaseSpiderClass.py
Last active March 11, 2018 15:36
爬虫基类
# coding=utf-8
import time
from datetime import datetime
from threading import Thread
from redis import StrictRedis
from redis.exceptions import ConnectionError
@awanabe
awanabe / flask_role_wrapper.py
Last active May 14, 2016 07:57
flask require_no_login_wrapper
def require_no_login(f):
@wraps(f)
def wrapper(*args, **kwargs):
if current_user.is_authenticated:
if request.method == 'POST':
return jsonify(success=False, error_msg='已经登录')
return redirect('/')
return f(*args, **kwargs)
return wrapper