Reputation: 817
I've just started to use twython, but on the first example:
from twython import Twython
t = Twython()
t.search(q='python')
I received an exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/twython-2.5.2-py2.7.egg/twython/twython.py", line 367, in search
return self.get('https://api.twitter.com/1.1/search/tweets.json', params=kwargs)
File "/usr/local/lib/python2.7/dist-packages/twython-2.5.2-py2.7.egg/twython/twython.py", line 238, in get
return self.request(endpoint, params=params, version=version)
File "/usr/local/lib/python2.7/dist-packages/twython-2.5.2-py2.7.egg/twython/twython.py", line 233, in request
content = self._request(url, method=method, params=params, files=files, api_call=url)
File "/usr/local/lib/python2.7/dist-packages/twython-2.5.2-py2.7.egg/twython/twython.py", line 210, in _request
retry_after=response.headers.get('retry-after'))
twython.twython.TwythonError: 'Bad Request: The request was invalid. An accompanying error message will explain why. This is the status code will be returned during rate limiting. -- An error occurred processing your request.'
Do anyone know what caused this exception?
Thanks,
L
Upvotes: 1
Views: 1051
Reputation: 9110
From the core examples:
from twython import Twython
""" Instantiate Twython with no Authentication """
twitter = Twython()
search_results = twitter.search(q="python", rpp="50")
for tweet in search_results["results"]:
print "Tweet from @%s Date: %s" % (tweet['from_user'].encode('utf-8'),tweet['created_at'])
print tweet['text'].encode('utf-8'),"\n"
I've tried it and it works.
Upvotes: 0
Reputation: 10740
Unauthenticated calls to Twitter API. Read here - https://dev.twitter.com/docs/rate-limiting.
Upvotes: 1