0

Well i am new to ipython and twython concepts and currently working on twython 2.5.4 now when i give the following code snippet

In [101]: search_results = twitter.searchTwitter(q="moon", rpp="50")

it gives me the following error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/vishal/<ipython-input-101-8f8e03087947> in <module>()
----> 1 search_results = twitter.searchTwitter(q="moon", rpp="50")

AttributeError: 'Twython' object has no attribute 'searchTwitter'.

Well what can be the problem

Thanks

minrk
  • 37,545
  • 9
  • 92
  • 87
Uselesssss
  • 2,127
  • 6
  • 28
  • 37

1 Answers1

1

The problem is that the command "searchTwitter" doesn't exist.

The correct way to write this piece of code would be:

twitter = Twython()

search_results = twitter.search(q="moon", page="50")

mimetist
  • 161
  • 6
  • hi mimetist Thanks but when i am writing as per your suggestion i am getting the following error – Uselesssss Jan 04 '13 at 04:05
  • /home/vishal/ in () ----> 1 search_results=twitter.search(q="man", page="1") /usr/local/lib/python2.7/dist-packages/twython-2.5.4-py2.7.egg/twython/twython.pyc in search(self, **kwargs) 365 """ 366 --> 367 return self.get('https://api.twitter.com/1.1/search/tweets.json', params=kwargs) 368 369 def searchGen(self, search_query, **kwargs): – Uselesssss Jan 04 '13 at 04:07
  • /usr/local/lib/python2.7/dist-packages/twython-2.5.4-py2.7.egg/twython/twython.pyc in get(self, endpoint, params, version) 236 237 def get(self, endpoint, params=None, version='1.1'): --> 238 return self.request(endpoint, params=params, version=version) 239 240 def post(self, endpoint, params=None, files=None, version='1.1'): – Uselesssss Jan 04 '13 at 04:07
  • usr/local/lib/python2.7/dist-packages/twython-2.5.4-py2.7.egg/twython/twython.pyc in request(self, endpoint, method, params, files, version) 231 url = '%s/%s.json' % (self.api_url % version, endpoint) 232 --> 233 content = self._request(url, method=method, params=params, files=files, api_call=url) 234 235 return content – Uselesssss Jan 04 '13 at 04:08
  • /usr/local/lib/python2.7/dist-packages/twython-2.5.4-py2.7.egg/twython/twython.pyc in _request(self, url, method, params, files, api_call) 208 raise exceptionType(error_msg, 209 error_code=response.status_code, --> 210 retry_after=response.headers.get('retry-after')) 211 212 # if we have a json error here, then it's not an official TwitterAPI error – Uselesssss Jan 04 '13 at 04:09
  • 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. – Uselesssss Jan 04 '13 at 04:09
  • is it because i have to provide authentication details or anything else is required – Uselesssss Jan 04 '13 at 04:09