def __init__(self): #pass # connect to redis self.r = redishelper.RedisHelper() self.r.set("zadmoni", 'tsunc20170801-') print self.r.get("name3") self.save_config_into_redis()
def login(): name = input("请输入用户名: ") passwd = input("请输入密码: ") pass1 = hash_pass(passwd) r = redishelper.RedisHelper() m = mysql_connect.MysqlConnect('/root/python/spider/misc/mysql_data.yaml') if r.get(name) == None: sql = "select password from user where name = '%s'" % (name) if len(m.select_data('test', sql)) == 0: print("无此用户,请注册") else: pass2 = m.select_data('test', sql)[0] if pass2[0] == pass1: print("成功") r.set(name, pass2[0]) else: print("密码错误") else: if r.get(name).decode('utf-8') == pass1: print("成功") else: print("密码错误")
def __init__(self): self.r = redishelper.RedisHelper() self.ip = settings.ClientIP self.host_config = self.get_host_config()
def __init__(self): self.r = redishelper.RedisHelper() # self.r.set('name', 'alex') self.save_config()
# coding: utf8 # @Author: 郭 璞 # @File: temp.py # @Time: 2017/8/27 # @Contact: [email protected] # @blog: http://blog.csdn.net/marksinoberg # @Description: import redishelper cfg = {"host": "127.0.0.1", "port": 6379, "db": 0} helper = redishelper.RedisHelper(cfg=cfg) print(helper.getValue('hashkey'))
def __init__(self): self.r = redishelper.RedisHelper() self.r.set("name", 'jhz') self.save_configs()
def config(): cfg['host'] = request.args.get('host') cfg['port'] = request.args.get('port') cfg['db'] = request.args.get('db') if request.args.get('db') else 0 helper = redishelper.RedisHelper(cfg) return "配置完毕!"