Ejemplo n.º 1
0
 def __init__(self, website):
     self.redis = redis_client()
     self.website = website
     # self.cookie_generate()
     self.cookie_check()
Ejemplo n.º 2
0
from redis_conn import redis_client

r = redis_client()
r.delete('weibo_account')

#新增
r.hset("weibo_account", "k1", "v1")
r.hset("weibo_account", "k2", "v2")
r.hset("weibo_account", "k3", "v3")
r.hset("weibo_account", "kkk", "12312312311")

#显示所有键值
print(r.hgetall('weibo_account'))
a = r.hgetall('weibo_account')
for k, v in a.items():
    print(k.decode(), v.decode())

print(r.hlen("weibo_account"))  #显示个数
r.hdel("hash1", "k1")  #删除一个键值对
r.hset("hash1", "k2", "v222")  #修改已有
Ejemplo n.º 3
0
 def __init__(self, store_type, website):
     self.redis = redis_client()
     self.store_type = store_type
     self.website = website
Ejemplo n.º 4
0
def save_cookies(cookies):
    cookies_str = json.loads(cookies)
    print(type(cookies_str))
    website_name = 'weibo_cookies'
    r = redis_client()
    r.lpush(website_name, cookies_str)
Ejemplo n.º 5
0
 def __init__(self):
     self.input_msg = 'Usage: {user:password} >> '
     self.exit_list = ['exit', 'q', 'quit']
     self.redis = redis_client()
     self.website = None
     self.start()