Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when searching tweets #271

Open
maelfosso opened this issue Dec 4, 2014 · 2 comments
Open

Error when searching tweets #271

maelfosso opened this issue Dec 4, 2014 · 2 comments

Comments

@maelfosso
Copy link

Hi,

I always get an error when trying to search tweets about a word or an hastag.
Here is a draf of the error :

ValueError                                Traceback (most recent call last)
<ipython-input-23-c59f6b4c0eda> in <module>()
      2 
      3 q = '#barcampcameroon'
----> 4 results = twitter_search(twitter_api, q, max_results = 1000)
      5 
      6 save_json(q, results)

<ipython-input-22-756dc1f1854b> in twitter_search(twitter_api, q, max_results, **kw)
     21 def twitter_search(twitter_api, q, max_results = 200, **kw) :
     22 
---> 23     search_results = twitter_api.search.tweets(q=q , count = 75, **kw)
     24 
     25     statuses = search_results['statuses']

/usr/local/lib/python2.7/dist-packages/twitter/api.pyc in __call__(self, **kwargs)
    264 
    265         req = urllib_request.Request(uriBase, body, headers)
--> 266         return self._handle_response(req, uri, arg_data, _timeout)
    267 
    268     def _handle_response(self, req, uri, arg_data, _timeout=None):

/usr/local/lib/python2.7/dist-packages/twitter/api.pyc in _handle_response(self, req, uri, arg_data, _timeout)
    288                 return wrap_response({}, handle.headers)
    289             elif "json" == self.format:
--> 290                 res = json.loads(data.decode('utf8'))
    291                 return wrap_response(res, handle.headers)
    292             else:

/usr/lib/python2.7/json/__init__.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    336             parse_int is None and parse_float is None and
    337             parse_constant is None and object_pairs_hook is None and not kw):
--> 338         return _default_decoder.decode(s)
    339     if cls is None:
    340         cls = JSONDecoder

/usr/lib/python2.7/json/decoder.pyc in decode(self, s, _w)
    364 
    365         """
--> 366         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    367         end = _w(s, end).end()
    368         if end != len(s):

/usr/lib/python2.7/json/decoder.pyc in raw_decode(self, s, idx)
    380         """
    381         try:
--> 382             obj, end = self.scan_once(s, idx)
    383         except StopIteration:
    384             raise ValueError("No JSON object could be decoded")

ValueError: Unterminated string starting at: line 1 column 81399 (char 81398)

It's always about No JSON object could be decode
Any idea about to solve it please ?

@hugovk
Copy link
Member

hugovk commented Dec 4, 2014

Duplicates? #256 #266 #271

@maelfosso
Copy link
Author

I think so ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants