Ejemplo n.º 1
0
def get_detect_information():
    task_information_dict = {}
    try:
        task_information_string = r.rpop(fb_target_domain_detect_queue_name)
    except:
        task_information_string = ''
    if task_information_string:
        task_information_dict = json.loads(task_information_string)
    else:
        task_information_dict = {}
    return task_information_dict
Ejemplo n.º 2
0
def main():
    while True:
        task_result = r.rpop(qq_document_task_name)
        if task_result:
            task_info_dict = json.loads(task_result)
            qq_xnr = task_info_dict['qq_xnr']
            qqbot_port = task_info_dict['qqbot_port']
            p_str = 'python receiveQQGroupMessage.py -i ' + port + ' >> login' + port + '.txt'
            p = subprocess.Popen(p_str, \
                     shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        else:
            break
Ejemplo n.º 3
0
def get_detect_information():
    task_information_dict = {}
    try:
        task_information_string = r.rpop(weibo_target_domain_detect_queue_name)
    except:
        task_information_string = ''
    #test
    #r_group.rpush(group_detect_queue_name, task_information_string)
    if task_information_string:
        task_information_dict = json.loads(task_information_string)
    else:
        task_information_dict = {}

    return task_information_dict
Ejemplo n.º 4
0
def get_detect_information():
    task_information_dict = {}
    try:
        task_information_string = r.rpop(weibo_target_domain_detect_queue_name)
        print 'successful'
        print task_information_string

    except:
        print "some bad in your comupte base"
        task_information_string = ''
    #test
    #r_group.rpush(group_detect_queue_name, task_information_string)
    if task_information_string:
        task_information_dict = json.loads(task_information_string)
    else:
        task_information_dict = {}

    return task_information_dict
Ejemplo n.º 5
0
def update_userinfo():
    results = dict()
    while True:
        task = r.rpop(update_userinfo_queue_name)
        if not task:
            break
        else:
            task_dict = json.loads(task)
            task_id = task_dict['task_id']
            weibo_mail_account = task_dict['weibo_mail_account']
            weibo_phone_account = task_dict['weibo_phone_account']
            pwd = task_dict['password']
            if weibo_mail_account:
                uname = weibo_mail_account
            elif weibo_phone_account:
                uname = weibo_phone_account
            else:
                break
            new_userinfo_dict = get_userinfo(uname, pwd)
            if new_userinfo_dict:
                update_dict = {'age': new_userinfo_dict['birth'],\
                        'job':new_userinfo_dict['job']}
                es.update(index=weibo_xnr_index_name,\
                    doc_type=weibo_xnr_index_type,id=task_id,body={'doc':item_exist})
Ejemplo n.º 6
0
def execute():
    bot.Login()
    bot.Plug('receiveQQGroupMessage')
    bot.Run()


def execute_v2(qqbot_port, qqbot_num, qqbot_mailauth):
    if not os.path.exists(QRCODE_PATH + qqbot_port):
        os.system('mkdir ' + QRCODE_PATH + qqbot_port)
    bot.Login(['-p', qqbot_port, '-b', QRCODE_PATH+qqbot_port, \
            '-r', '-q', qqbot_num, \
            '-m', qqbot_num+'@qq.com', '-mc', qqbot_mailauth, \
            '-dm'])
    bot.Plug('receiveQQGroupMessage')
    bot.Run()


if __name__ == '__main__':

    # 从队列获取qq端口、授权码等消息,用于后台主进程调用

    while True:
        temp = r.rpop(r_qq_receive_message)
        qq_info = json.loads(temp)
        qqbot_port = qq_info['qq_port']
        qqbot_num = qq_info['qq_num']
        qqbot_mailauth = qq_info['access_id']

        execute_v2(qqbot_port, qqbot_num, qqbot_mailauth)