tweepy/tweepy — pull request #182 by rogeliorv (2012-06-12 02:15:39+00:00)
Title: streaming.py filter not working on it's current status

Hey Josh and other contributors. A couple of bug fixes for streaming.py file, all other files in my pull request may be safely ignored since they are just helper and utility functions.

streaming.py is missing a string strip() so isdigit() returns true on line 160

FROM:

```# read the next twitter status object
if delimited_string.isdigit(): # <--- This will never evaluate to true
next_status_obj = resp.read( int(delimited_string) )
self._data(next_status_obj)
```

TO:

```# read the next twitter status object
if delimited_string.strip().isdigit():
next_status_obj = resp.read( int(delimited_string) )
self._data(next_status_obj)
```

Furthermore in its current state the streaming.py filter function wont work with non-ascii parameters for follow or track parameters.

filter function, line 220

FROM:

```def filter(self, follow=None, track=None, async=False, locations=None, count = None):
# [...] previous lines here
if follow:
self.parameters['follow'] = ','.join(map(str, follow))
if track:
self.parameters['track'] = ','.join(map(str, track))
```

TO:

```def filter(self, follow=None, track=None, async=False, locations=None, count = None, encoding='utf8'):
#[...] previous lines here
if follow:
encoded_follow = [unicode(s).encode(encoding) for s in follow]
self.parameters['follow'] = ','.join(encoded_follow)
if track:
encoded_track = [unicode(s).encode(encoding) for s in track]
self.parameters['track'] = ','.join(encoded_track)
```