所有尝试从Twitter中提取数据导致'module'对象没有属性'OAuthHandler'

时间:2018-06-03 14:43:10

标签: python python-3.x oauth pip tweepy

我试图从Twitter中提取数据,然后我按照应该完成的所有步骤进行操作,但我不知道出了什么问题!

import csv
#from tweepy.auth import OAuthHandler
import tweepy

Access_token = "........"
Access_token_secret = "..........."
consumer_key = "..............."
consumer_secret = "........."

auth = tweepy.OAuthHandler(Access_token, Access_token_secret)
auth.set_access_token(consumer_key, consumer_secret)

api = tweepy.API(auth)

但是存在隐藏的问题!

错误:

Traceback (most recent call last):
  File "C:/Users/dddd/PycharmProjects/Project1/tweepy.py", line 3, in <module>
    import tweepy
  File "C:\Users\dddd\PycharmProjects\Project1\tweepy.py", line 10, in <module>
    auth = tweepy.OAuthHandler(Access_token, Access_token_secret)
AttributeError: 'module' object has no attribute 'OAuthHandler'

1 个答案:

答案 0 :(得分:0)

像这样使用:

paste