I am trying to get the user ID for a twitter user using a python
import twitter
twitter_api = twitter.Twitter(domain='api.twitter.com', api_version='1',auth = twitter.oauth.OAuth(ACCESS_KEY, ACCESS_SECRET,
CONSUMER_KEY, CONSUMER_SECRET))
usr = twitter_api.api.GetUser(SCREEN_NAME)
print usr.name
Does not work, and the debug information is not of much help, I did not find any more resources online.
The
twitter_apiobject that you’ve instantiated implicitly converts all function calls performed on it into the path of the API URL, with any keyword arguments converted to API parameters. For example:Hence, you’re trying to call the URL
1/api/GetUser.json– and also passing it an argument, which it doesn’t know how to handle. Try this instead: