Beispiel #1
0
def tw_comment(account_name, password, _id, uid, text, tweet_type,
               xnr_user_no):

    operation = Operation(account_name, password)

    try:
        #screen_name = 'zhu0588'
        #operation.target(nick_name)
        # print 'comment...',operation.do_comment(_id, uid,text)
        operation.do_comment(uid, _id, text)

        mark = True

    except:
        mark = False

    message_type = 2  # 评论

    try:
        save_mark = tw_save_to_xnr_flow_text(tweet_type, xnr_user_no, text,
                                             message_type)
    except:
        print '保存微博过程遇到错误!'
        save_mark = False

    return mark
Beispiel #2
0
def tw_message(account_name, password, text, uid):

    operation = Operation(account_name, password)

    try:
        operation.message(uid, text)
        mark = True
    except:
        mark = False

    return mark
Beispiel #3
0
def tw_like(account_name, password, _id):
    # uid: 原贴用户id
    operation = Operation(account_name, password)

    try:
        operation.do_favourite(long(_id))
        mark = True
    except:
        mark = False

    return mark
Beispiel #4
0
def tw_unfollow(account_name, password, uid, xnr_user_no):

    operation = Operation(account_name, password)

    try:
        operation.destroy_friendship(uid)
        mark = True
    except:
        mark = False

    #save_type = 'friends'
    #follow_type = 'unfollow'
    # trace_type = 'trace_follow' or 'ordinary_follow'
    #trace_type = 'trace_follow'

    # tw_save_to_fans_follow_ES(xnr_user_no,uid,follow_type,trace_type)
    #tw_save_to_fans_follow_ES(xnr_user_no,screen_name,follow_type,trace_type)

    return mark
Beispiel #5
0
def tw_mention(account_name, password, text, xnr_user_no, tweet_type):
    # text = '@lvleilei1 test'
    operation = Operation(account_name, password)

    #try:
    print operation.mention(text)
    mark = True
    # except:
    #     mark = False

    message_type = 4  # 提到

    try:
        save_mark = tw_save_to_xnr_flow_text(tweet_type, xnr_user_no, text,
                                             message_type)
    except:
        print '保存微博过程遇到错误!'
        save_mark = False

    return mark
Beispiel #6
0
def tw_follow(account_name, password, uid, xnr_user_no, trace_type):

    operation = Operation(account_name, password)

    try:
        operation.follow(uid)
        mark = True
    except:
        mark = False
    ###
    # ?????????  screen_name ? uid
    ####
    #save_type = 'followers'
    follow_type = 'follow'
    # trace_type = 'trace_follow' or 'ordinary_follow'
    if trace_type == 'trace_follow':
        tw_save_to_fans_follow_ES(xnr_user_no, uid, follow_type, trace_type)
        #tw_save_to_fans_follow_ES(xnr_user_no,screen_name,follow_type,trace_type)

    return mark
Beispiel #7
0
def tw_publish(account_name, password, text, tweet_type, xnr_user_no):

    operation = Operation(account_name, password)

    try:
        operation.publish(text)
        #print 'publish....',
        mark = True
    except:
        mark = False

    message_type = 1  # 原创

    try:
        save_mark = tw_save_to_xnr_flow_text(tweet_type, xnr_user_no, text,
                                             message_type)
    except:
        print '保存微博过程遇到错误!'
        save_mark = False

    return mark
Beispiel #8
0
def tw_retweet(account_name, password, _id, uid, text, tweet_type,
               xnr_user_no):

    operation = Operation(account_name, password)

    try:

        operation.do_retweet(_id)
        #operation.do_retweet(_id,text)

        mark = True
    except:
        mark = False

    message_type = 3  # 转发

    try:
        save_mark = tw_save_to_xnr_flow_text(tweet_type, xnr_user_no, text,
                                             message_type)
    except:
        print '保存微博过程遇到错误!'
        save_mark = False

    return mark