def publish_tweet_func(account_name, password, text, p_url, rank, rankid, tweet_type, xnr_user_no): xnr = SinaLauncher(account_name, password) xnr.login() user = SinaOperateAPI(xnr.uid) user.text = text user.rank = rank new_p_url = user.request_image_url(p_url) user.pic_ids = ' '.join(new_p_url) user.rankid = rankid #print 'user.pic_ids::',user.pic_ids mark = user.publish() print 'mark...', mark # 保存微博 if mark: try: save_mark = save_to_xnr_flow_text(tweet_type, xnr_user_no, text) except: print '保存微博过程遇到错误!' save_mark = False return mark
def create_group_func(account_name, password, group, members): xnr = SinaLauncher(account_name, password) xnr.login() user = SinaOperateAPI(xnr.uid) user.group = group user.members = members mark = user.createGroup() return mark
def like_tweet_func(account_name, password, r_mid): xnr = SinaLauncher(account_name, password) xnr.login() user = SinaOperateAPI(xnr.uid) user.r_mid = r_mid mark = user.like() return mark
def private_tweet_func(account_name, password, text, r_mid): xnr = SinaLauncher(account_name, password) xnr.login() user = SinaOperateAPI(xnr.uid) user.text = text user.r_mid = r_mid mark = user.privmessage() return mark
def reply_tweet_func(account_name, password, text, r_mid, mid, uid): xnr = SinaLauncher(account_name, password) xnr.login() user = SinaOperateAPI(xnr.uid) user.text = text user.r_mid = r_mid # user.r_uid = xnr.uid user.uid = uid user.cid = mid mark = user.receive() return mark
def follow_tweet_func(xnr_user_no, account_name, password, uid, trace_type): xnr = SinaLauncher(account_name, password) xnr.login() user = SinaOperateAPI(xnr.uid) user.r_mid = uid mark = user.followed() save_type = 'followers' follow_type = 'follow' save_to_fans_follow_ES(xnr_user_no, uid, save_type, follow_type, trace_type) return mark
def retweet_tweet_func(account_name, password, text, r_mid, tweet_type, xnr_user_no): xnr = SinaLauncher(account_name, password) xnr.login() user = SinaOperateAPI(xnr.uid) user.text = text user.r_mid = r_mid mark = user.retweet() # 保存微博 if mark: try: save_mark = save_to_xnr_flow_text(tweet_type, xnr_user_no, text) except: print '保存微博过程遇到错误!' save_mark = False return mark