Постоянно получаю ответ Twitter об ошибке: код состояния = 400 Как я могу это исправить
with open('twitter_credentials.json') as credentials_data:
info = json.load(credentials_data)
Api_key = info['API_KEY']
Api_key_secret = info['API_KEY_SECRET']
Access_token = info['ACCESS_TOKEN']
Access_token_secret = info['ACCESS_TOKEN_SECRET']
class TwitterAuthenticator:
def TwitterApplicationAuthentication(self):
auth = OAuthHandler(Api_key, Api_key_secret)
auth.set_access_token(Access_token, Access_token_secret)
api = API(auth)
class TwitterClient:
def __init__(self, twitter_user):
self.auth = TwitterAuthenticator.TwitterApplicationAuthentication(self)
self.twitter_client = API(self.auth)
self.twitter_user = twitter_user
def get_user_timeline_tweets(self,num_tweets):
all_tweets = []
for tweet in Cursor(self.twitter_client.user_timeline, id=self.twitter_user).items(num_tweets):
tweets.extend(tweet)
return all_tweets
if __name__ == '__main__':
twitter_client = TwitterClient('elonmusk')
print(twitter_client.get_user_timeline_tweets(3))
Я получаю сообщение об ошибке, когда запускаю последний код, напечатайте ....