pyfoo / python-twitter

Automatically exported from code.google.com/p/python-twitter
Apache License 2.0
0 stars 0 forks source link

Trends support #104

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi there,

I've wired up retrieval of current trends in the Api class. It returns a
list of trend name strings.

Here is the function:

  def GetTrendsCurrent(self):
    ''' Return current twitter trends.

    Args:
    Returns:
      A list of twitter trend strings.
    '''
    # Build request parameters
    parameters = {}

    # Make and send requests
    url = 'http://search.twitter.com/trends/current.json'

    json = self._FetchUrl(url,  parameters=parameters)
    data = simplejson.loads(json)
    self._CheckForTwitterError(data)

    trends = []

    for date in data['trends'].items():
        if (len(date) > 1):
            for item in date[1]:
                trends.append(item['name'])

    # Return list of trends
    return trends

Original issue reported on code.google.com by andrewse...@gmail.com on 16 Nov 2009 at 10:20

GoogleCodeExporter commented 9 years ago
Clone created here:
https://code.google.com/r/andrewseigner-python-twitter/source/browse/twitter.py

diff summary:
added geo, trends, and rate limit support

detailed changes:
added Status::GetLocation()
added Status::SetLocation()
added geo support to Status::NewFromJsonDict()
added Api::GetTrendsCurrent()
added Api::GetRateLimitStatus()
added Api::MaximumHitFrequency()

Original comment by andrewse...@gmail.com on 13 Dec 2009 at 1:27

GoogleCodeExporter commented 9 years ago
Patch for Issue 169 applied which added Trends support - marking as fixed

Original comment by bear42 on 16 Oct 2010 at 7:27