每转推,都喜欢吗?蟒蛇

时间:2017-02-17 21:33:04

标签: python api twitter

我是一个体面的新编码器,我正在创建一个机器人,所以每次我转推一些东西,我最喜欢它,也许跟随同一个人。我的代码:

def retweet(tweet_cid):
    try:
        api.retweet(tweet_cid)
        time.sleep(random.randit(range(50,900)))
    except Exception as e:
        print(str(e))
        pass

def follow(screen_name):
try:
    api.create_friendship(screen_name)
    time.sleep(random.randit(range(50,900))) 
except Exception as e:
        print(str(e))
        pass

def fav(tweet_cid):
    try:
        api.create_favourite(tweet_cid)
        time.sleep(random.randit(range(600,1100)))
    except Exception as e:
        print(str(e))
        pass

1 个答案:

答案 0 :(得分:0)

你应该有一个回调函数,只要调用follow()而不是fav(),就会调用retweet()time.sleep()