You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. attempt to execute twitter.Api.GetTrendsCurrent()
2.
3.
What is the expected output? What do you see instead?
The list of triends should be assigned
This is what I get instead
>>> a = api.GetTrendsCurrent()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "twitter.py", line 2435, in GetTrendsCurrent
for t in data['trends']:
KeyError: 'trends'
What version of the product are you using? On what operating system?
python-twitter 0.8.2 with python 2.7.2 on ubuntu linux
Please provide any additional information below.
The GET trends/current call is listed as deprecated on dev.twitter.com
The new call is GET trends/:woeid to get the top 10 trends for "woeid" and GET
trends/available to list woeid available
Original issue reported on code.google.com by [email protected] on 28 Apr 2012 at 1:39
The text was updated successfully, but these errors were encountered:
I have the same problem on Freebsd 9.0/amd64
Temporary workarround is to define the method yourself
def GetTrendsCurrent(self, exclude=None, woeid="1"):
parameters = {}
if exclude:
parameters['exclude'] = exclude
url = '%(url)s/trends/%(woeid)s.json' % { "url" : self.base_url, "woeid" : woeid }
json = self._FetchUrl(url, parameters=parameters)
data = simplejson.loads(json)
self._CheckForTwitterError(data)
trends = []
for t in data[0]['trends']:
trends.append(twitter.Trend.NewFromJsonDict(t, timestamp = data[0]['created_at']))
return trends
Then override the api's method with your new method
api.GetTrendsCurrent = types.MethodType( GetTrendsCurrent, api )
I have attached a patch
Original issue reported on code.google.com by
[email protected]
on 28 Apr 2012 at 1:39The text was updated successfully, but these errors were encountered: