@idrGpaxGSS4VNTq (mo)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Python3でTwitterAPIを認証するには

解決したいこと

PythonとKH Coderをつかって、TwitterAPIからツイートの収集→データ分析をしたいと考えています。
下記の記事を参考にしているのですが、TwitterAPI認証がはじかれてしまいます。
解決方法を教えてください。

https://note.com/kumonnu/n/nbca51f7af3c2#RAO6S
https://www.learning-nao.com/?p=2045

発生している問題・エラー

TypeError                                 Traceback (most recent call last)
<ipython-input-3-906a4d9d71d3> in <module>
      8 auth = tweepy.OAuthHandler(API_Key, API_Sec)
      9 auth.set_access_token(Token, Token_Sec)
---> 10 api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_notify=True)
     11 return api

TypeError: __init__() got an unexpected keyword argument 'wait_on_rate_notify'

該当するソースコード

ソースコードを入力
```conda install -c conda-forge tweepy
import tweepy

API_Key     = "AAAA"
API_Sec     = "AAAA"
Token       = "AAAA"
Token_Sec   = "AAAA"

auth = tweepy.OAuthHandler(API_Key, API_Sec)
auth.set_access_token(Token, Token_Sec)
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_notify=True)
return api

自分で試したこと

実行環境
Windows10 
Python3.7.7 (Anaconda3)
Jupyter notebook

tweepy以外はインストール・インポートしていません。
Developper PortalではOAuth1.0aとRequest email from users(optional)をオンにし、
WebsaiteURLには適当なURLを入れています。

CallbackURLは一度も弄っていません。

0 likes

1Answer

TypeError: init() got an unexpected keyword argument 'wait_on_rate_notify'

とあるように、キーワード引数が不正です。

APIリファレンスを見る限り、
正しいパラメータ名はwait_on_rate_limit_notifyです。
limitが不足)

0Like

Your answer might help someone💌