gfcapalbo / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

handle json parsing errors better (e.g. for GetLists()) #208

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I got everything set up and running the API sample program, tweet.py.

  I got these two API calls went through without problem.
  print api.GetFriends()[0]
  print api.VerifyCredentials()     

 But when calling  this
  print api.GetLists('twitter-user')[0]
It gives me problem in Json?  Is that Json problem?
============================================
  File "C:\Python27\Lib\site-packages\python_twitter-0.8.3-py2.7.egg\twitter.py", line 1658, in __str__
    return self.AsJsonString()
  File "C:\Python27\Lib\site-packages\python_twitter-0.8.3-py2.7.egg\twitter.py", line 1666, in AsJsonString
    return simplejson.dumps(self.AsDict(), sort_keys=True)
  File "C:\Python27\lib\json\__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "C:\Python27\lib\json\encoder.py", line 203, in encode
    chunks = list(chunks)
  File "C:\Python27\lib\json\encoder.py", line 428, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "C:\Python27\lib\json\encoder.py", line 402, in _iterencode_dict
    for chunk in chunks:
  File "C:\Python27\lib\json\encoder.py", line 436, in _iterencode
    o = _default(o)
  File "C:\Python27\lib\json\encoder.py", line 178, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <twitter.User object at 0x00CA0F90> is not JSON serializable

=============================

Original issue reported on code.google.com by Cardinal...@gmail.com on 5 Sep 2011 at 9:24

GoogleCodeExporter commented 9 years ago
Issue 219 has been merged into this issue.

Original comment by bear42 on 30 Nov 2011 at 9:21

GoogleCodeExporter commented 9 years ago
We should make the json parsing of the twitter responses more robust - morphing 
this bug to track that

Original comment by bear42 on 30 Nov 2011 at 9:22

GoogleCodeExporter commented 9 years ago

Original comment by bear42 on 30 Nov 2011 at 9:22