Regarding the tweepy docs for using Twitter API v2 i should be able to like a tweet with the following code.
import tweepy
from keys import keys
# bearer token for twitter developers
client = tweepy.Client(bearer_token=keys["bearer_token"])
# checks for latest tweets
def like_tweets():
like = client.like(1466906017120153601)
print(like)
like_tweets()
I both tried to pass the tweet id as a string and as an integer. I checked the tweet id manually for correctness and also tried different tweet ids.
But i get the following error everytime:
File "C:UsersmynamepathtopythonPythonPython37site-packagestweepyclient.py", line 387, in like
id = self.access_token.partition('-')[0]
AttributeError: 'NoneType' object has no attribute 'partition'
Do you have ideas or suggestions how to solve this problem?
2
Answers
I was not able to encode the exact error, but found out, that this method need's the whole access data, including the
consumer_token, consumer_secret, access_token and access_token_secret
.I just came across the same issue.
The solution was to specify the other tokens when creating the client:
And then calling
(letting the default option user_auth=True)