MCPcopy Index your code
hub / github.com/clips/pattern / parse

Method parse

pattern/web/__init__.py:1533–1547  ·  view source on GitHub ↗

TwitterStream.queue will populate with Result objects as TwitterStream.update() is called iteratively.

(self, data)

Source from the content-addressed store, hash-verified

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
1549def author(name):
1550 """ Returns a Twitter query-by-author-name that can be passed to Twitter.search().

Callers

nothing calls this directly

Calls 3

ResultClass · 0.85
stripMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected