Пробовал:
Код: Выделить всё
import tweepy
api_key = ""
api_secret = ""
bearer_token = ""
access_token = ""
access_token_secret = ""
client = tweepy.Client(bearer_token, api_key, api_secret, access_token,access_token_secret)
auth = tweepy.OAuth1UserHandler(api_key, api_secret, access_token, access_token_secret)
api = tweepy.API(auth)
# Function to like a tweet
def like_tweet(tweet_id):
try:
client.like(tweet_id)
print(f"Successfully liked tweet {tweet_id}")
except tweepy.TweepyException as e:
print(f"Error: {e}")
# Like the tweet with the specified ID
like_tweet(1813606495118062034)
Код: Выделить всё
diyagirishkumar@Diyas-MacBook-Air twitterbot % /usr/local/b in/python3 /Users/diyagirishkumar/twitterbot/tweepy_setup.p y Error: 403 Forbidden When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal. Код: Выделить всё
{ "title": "Unauthorized", "type": "about:blank", "status": 401, "detail": "Unauthorized" } Подробнее здесь: https://stackoverflow.com/questions/787 ... t-keys-tok
Мобильная версия