LoginSignup
2
0

More than 1 year has passed since last update.

Tweepyの'API' object has no attribute 'me'

Posted at

はじめに

Tweepyのバージョンを4.10.0に上げたら怒られたメモ

API.meの廃止

AttributeError: 'API' object has no attribute 'me'

実行したときにはAPI.meで例外が吐かれました。

https://github.com/tweepy/tweepy/blob/master/docs/faq.rst#where-did-apime-go

faqにある通り3から4で廃止されたようです。代わりとしてAPI.verify_credentialsを使えばよいと書かれています。

auth = tweepy.OAuth1UserHandler(
        CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
)
api = tweepy.API(auth)
user = api.verify_credentials()
print(user.name, user.screen_name)
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0