Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tweepy针对以下用户_Python_Python 3.x_Twitter_Bots_Tweepy - Fatal编程技术网

Python Tweepy针对以下用户

Python Tweepy针对以下用户,python,python-3.x,twitter,bots,tweepy,Python,Python 3.x,Twitter,Bots,Tweepy,我发现自己需要一个机器人来跟踪推特上的用户 当我说user时,我指的不是一个跟随者,而是一个随机的用户,我会用“Cursor”找到它。我正试图修改我的twitter机器人,使其在特定搜索的时间线上符合用户的搜索要求。我不知道如何实现的是,如何准确地将时间线中的用户作为目标来“创建_Friendly()”?我不是针对某个特定的用户,所以我不想指定“Id”或“screen\u name”等 在Tweepy文档中,我找不到解决方案,可能是在我眼皮底下,但我是个新手,我需要一些帮助 这是我用来喜欢推特的

我发现自己需要一个机器人来跟踪推特上的用户

当我说user时,我指的不是一个跟随者,而是一个随机的用户,我会用“Cursor”找到它。我正试图修改我的twitter机器人,使其在特定搜索的时间线上符合用户的搜索要求。我不知道如何实现的是,如何准确地将时间线中的用户作为目标来“创建_Friendly()”?我不是针对某个特定的用户,所以我不想指定“Id”或“screen\u name”等

在Tweepy文档中,我找不到解决方案,可能是在我眼皮底下,但我是个新手,我需要一些帮助

这是我用来喜欢推特的推特机器人的代码


进口粗花呢
导入时间
auth=tweepy.OAuthHandler(“”,“”)
授权设置访问令牌(“”,“”)
api=tweepy.api(auth,wait\u on\u rate\u limit=True,wait\u on\u rate\u limit\u notify=True)
search=“searc”
nrTweets=100
对于tweepy.Cursor(api.search,search.items)(nrTweets)中的tweet:
尝试:
打印('用户成功跟踪')
tweet.favorite()#在这里,我应该可以随心所欲地建立友谊
时间。睡眠(60)
除tweepy.TweepError为e外:
打印(如原因)
除停止迭代外:
打破

我怎样才能把这个机器人变成一个以我喜欢的推特方式跟随人们的机器人?(对于带有特定关键字的搜索)

如果有人在乎,我就是这样决定的

# Write a function named collatz() that has one parameter named number. If
# number is even, then collatz() should print number // 2 and return this value.
# If number is odd, then collatz() should print and return 3 * number + 1

# Then write a program that lets the user type in an integer and that keeps
# calling collatz() on that number until the function returns the value 1.

# Add try and except statements to the previous project to detect whether the
# user types in a noninteger string. Normally, the int() function will raise a
# ValueError error if it is passed a noninteger string, as in int('puppy'). In the
# except clause, print a message to the user saying they must enter an integer.


try:
    number = int(input(("Enter an integer number ")))

    def collatz():

        global number

        if number % 2 == 0:
            print(int(number/2))
            number = (number/2)

        elif number % 2 == 1:
            print(int(3*number+1))
            number = (3*number+1)

        else:
            return

    while number != 1:
        collatz()

except:
    print("man, an integer number please! ")

我对这个答案投了反对票,因为UI的粗俗是不必要的、毫无理由的。