def add_operate2redis(item_dict): queue_dict = {} queue_dict['channel'] = item_dict['channel'] # weibo、facebook、twitter queue_dict['operate_type'] = item_dict['operate_type'] # publish-发帖、retweet-转发、comment-评论、like-点赞、follow-关注、unfollow-取消关注、at-提到、private-私信 # add-发送添加好友请求、confirm-确认好友请求、delete-删除好友请求 # receive - 回复 queue_dict['content'] = item_dict['content'] try: content = r_operate_queue.lpush(operate_queue_name, json.dumps(queue_dict)) mark = True except: mark = False return mark if __name__ == '__main__': # save_to_fans_follow_ES('WXNR0004','1496814565','followers') #es_xnr.delete(index=weibo_xnr_fans_followers_index_name,doc_type=weibo_xnr_fans_followers_index_type,\ # id='AV4Zi0NasTFJ_K1Z2dDy') print r_operate_queue.lrange(operate_queue_name, 0, 8) # print r_operate_queue.rpop(operate_queue_name)
# -*-coding:utf-8-*- import sys import json sys.path.append('../') from global_utils import RE_QUEUE as re from global_utils import R_OPERATE_QUEUE as r, operate_queue_name # R_OPERATE_QUEUE = redis.StrictRedis(host=REDIS_HOST_45, port=REDIS_PORT_45, db=3) # operate_queue_name = 'opetate' #print re.lrange('params', 0, 10) #print re.lrange('fb_tweet_params', 0, 10) # 测试45redis上的队列 test_dict = {"test": "hello world"} #r.lpush(operate_queue_name, json.dumps(test_dict)) #print r.lrange("operate", 0, 10) print r.lrange(operate_queue_name, 0, 10)