예제 #1
0
                            print '111111111111111get submit_baocuo', e
                            pass

                    elif operate_type == 'retweet':
                        try:
                            task_detail['channel'] = "facebook"
                            task_detail['operate_type'] = "retweet"
                            mark = get_retweet_operate_fb(task_detail)
                        except Exception, e:
                            print 222222222222222, e
                            # add_operate2redis(queue_dict)
                    elif operate_type == 'comment':
                        try:
                            task_detail['channel'] = "facebook"
                            task_detail['operate_type'] = "comment"
                            mark = get_comment_operate_fb(task_detail)
                        except Exception, e:
                            #add_operate2redis(queue_dict)
                            print 333333333333333, e
                            pass
                    elif operate_type == 'like':
                        try:
                            task_detail['channel'] = "facebook"
                            task_detail['operate_type'] = "like"
                            mark = get_like_operate_fb(task_detail)
                        except Exception, e:
                            #add_operate2redis(queue_dict)
                            print 444444444444444, e
                            pass

                    elif operate_type == 'at':
예제 #2
0
def operate_out_of_redis():

    while True:
        temp = r.rpop(operate_queue_name)
        #print 'temp.',temp
        if not temp:
            break

        queue_dict = json.loads(temp)

        channel = queue_dict['channel']
        operate_type = queue_dict['operate_type']

        task_detail = queue_dict['content']

        if channel == 'facebook':
            if operate_type == 'publish':
                try:
                    print 'task_detail..', task_detail
                    mark = get_submit_tweet_fb(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'retweet':
                try:
                    mark = get_retweet_operate_fb(task_detail)
                except Exception, e:
                    print e
                    # add_operate2redis(queue_dict)
            elif operate_type == 'comment':
                try:
                    mark = get_comment_operate_fb(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'like':
                try:
                    mark = get_like_operate_fb(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'at':
                try:
                    mark = get_at_operate_fb(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'private':
                try:
                    mark = get_private_operate_fb(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'add':
                try:
                    mark = get_add_friends(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'confirm':
                try:
                    mark = get_confirm_friends(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'delete':
                try:
                    mark = get_delete_friends(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

        elif channel == 'twitter':
            if operate_type == 'publish':
                try:
                    mark = get_submit_tweet_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'retweet':
                try:
                    mark = get_retweet_operate_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'comment':
                try:
                    mark = get_comment_operate_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'like':
                try:
                    mark = get_like_operate_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'at':
                try:
                    mark = get_at_operate_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'private':
                try:
                    mark = get_private_operate_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'follow':
                try:
                    mark = get_follow_operate_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass

            elif operate_type == 'unfollow':
                try:
                    mark = get_unfollow_operate_tw(task_detail)
                except:
                    #add_operate2redis(queue_dict)
                    pass