TwitterStream.queue will populate with Result objects as TwitterStream.update() is called iteratively.
(self, data)
| 1531 | self.format = format |
| 1532 | |
| 1533 | def parse(self, data): |
| 1534 | """ TwitterStream.queue will populate with Result objects as |
| 1535 | TwitterStream.update() is called iteratively. |
| 1536 | """ |
| 1537 | if data.strip(): |
| 1538 | x = json.loads(data) |
| 1539 | r = Result(url=None) |
| 1540 | r.id = self.format(x.get("id_str")) |
| 1541 | r.url = self.format(TWITTER_STATUS % (x.get("user", {}).get("screen_name"), x.get("id_str"))) |
| 1542 | r.text = self.format(x.get("text")) |
| 1543 | r.date = self.format(x.get("created_at")) |
| 1544 | r.author = self.format(x.get("user", {}).get("screen_name")) |
| 1545 | r.profile = self.format(x.get("user", {}).get("profile_image_url")) |
| 1546 | r.language = self.format(x.get("metadata", {}).get("iso_language_code")) |
| 1547 | return r |
| 1548 | |
| 1549 | def author(name): |
| 1550 | """ Returns a Twitter query-by-author-name that can be passed to Twitter.search(). |