2.10.1 #209

Merged
michaelhelmick merged 7 commits from dev into master 2013-05-29 08:42:31 -07:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit 64b1349993 - Show all commits

View file

@ -102,7 +102,7 @@ class TwythonAPITestCase(unittest.TestCase):
counter = 0 counter = 0
while counter < 2: while counter < 2:
counter += 1 counter += 1
result = search.next() result = next(search)
new_id_str = int(result['id_str']) new_id_str = int(result['id_str'])
if counter == 1: if counter == 1:
prev_id_str = new_id_str prev_id_str = new_id_str

View file

@ -1,5 +1,5 @@
from .. import __version__ from .. import __version__
from ..compat import json from ..compat import json, is_py3
from ..exceptions import TwythonStreamError from ..exceptions import TwythonStreamError
from .types import TwythonStreamerTypes from .types import TwythonStreamerTypes
@ -93,6 +93,10 @@ class TwythonStreamer(object):
break break
if line: if line:
try: try:
if not is_py3:
self.on_success(json.loads(line))
else:
line = line.decode('utf-8')
self.on_success(json.loads(line)) self.on_success(json.loads(line))
except ValueError: except ValueError:
raise TwythonStreamError('Response was not valid JSON, \ raise TwythonStreamError('Response was not valid JSON, \