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

Method trends

pattern/web/__init__.py:1506–1516  ·  view source on GitHub ↗

Returns a list with 10 trending topics on Twitter.

(self, **kwargs)

Source from the content-addressed store, hash-verified

1504 return results
1505
1506 def trends(self, **kwargs):
1507 """ Returns a list with 10 trending topics on Twitter.
1508 """
1509 url = URL("https://api.twitter.com/1.1/trends/place.json?id=1")
1510 url = self._authenticate(url)
1511 kwargs.setdefault("cached", False)
1512 kwargs.setdefault("unicode", True)
1513 kwargs.setdefault("throttle", self.throttle)
1514 data = url.download(**kwargs)
1515 data = json.loads(data)
1516 return [u(x.get("name")) for x in data[0].get("trends", [])]
1517
1518 def stream(self, query, **kwargs):
1519 """ Returns a live stream of Result objects for the given query.

Callers

nothing calls this directly

Calls 5

_authenticateMethod · 0.95
downloadMethod · 0.95
URLClass · 0.85
setdefaultMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected