我已经克隆了 github repo。从 read.me 文件中复制消费者密钥和访问令牌。
代码:
def retrieving_tweets_polarity(符号): stock
your text
_ticker_map = pd.read_csv('Yahoo-Finance-Ticker-Symbols.csv')
stock_full_form = stock_ticker_map[stock_ticker_map['Ticker']==symbol]
symbol = stock_full_form['Name'].to_list()[0][0:12]
auth = tweepy.OAuthHandler(consumer_key= '7x7w8Ti8GmMtuhvj7IXBuvZmP', consumer_secret= 'kpFGcKiGxP9dJtlQzZ99p2OK9HM0IjA1I8n23N40VJyctOzvkG')
auth.set_access_token(access_token= '1365544389498474497-97lzyZE9lroLNDzLhvW1dLS3MDKfV5', access_token_secret= '8mF9CrBt4SvmewPZaapgL7kkh2iJus824SvhBJOvDpXlw')
user = tweepy.API(auth)
tweets = tweepy.Cursor(user.search, q=symbol, tweet_mode='extended', lang='en',exclude_replies=True).items(ct.num_of_tweets)
错误:
TypeError: set_access_token() 得到了一个意外的关键字参数 'access_token' 127.0.0.1 - - [2023 年 3 月 7 日 11:25:07]“POST /insertintotable HTTP/1.1”500 -
我尝试更新 tweepy 但它没有用