user9016934
user9016934

Reputation:

404: {“errors”:[{“message”:”Sorry, that page does not exist”,”code”:34}]}

I m trying to get 10 tweets made by a user using python tweepy.The code:

import tweepy

consumer_key=""
consumer_secret=""
access_token=""
access_token_secret=""

#authorise access to Twitter on our behalf
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)



usertweets=api.user_timeline(["username"],[10])
for tweet in usertweets:
    print (tweet.text)


If i give my own username it works but for some reason i dont get only 10 tweets but all the tweets i ve done and if i give as a username any other username i get this

error:404: {“errors”:[{“message”:”Sorry, that page does not exist”,”code”:34}]}

The other usernames by the way exist.Also sometimes it doesnt give me an error when i use different username than mine but instead it prints my own tweets.Any idea what could be going wrong?

Upvotes: 0

Views: 1920

Answers (1)

kszl
kszl

Reputation: 1213

It looks like you misunderstood the documentation. Square brackets in docs usually mean that an argument is optional. You can pass it, but you don't have to. You are not supposed to use [] in the real query. For example:

API.user_timeline

API.user_timeline([id/user_id/screen_name][, since_id][, max_id][, count][, page])

could be used that way:

usertweets=api.user_timeline(screen_name='some_user_name', count=10)

Upvotes: 1

Related Questions