· 6 years ago · Dec 05, 2018, 09:28 AM
1import tweepy
2import json
3
4CONSUMER_KEY = ''
5CONSUMER_SECRET = ''
6OAUTH_TOKEN = ''
7OAUTH_TOKEN_SECRET = ''
8
9auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
10auth.set_access_token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
11
12twitter_api = tweepy.API(auth)
13# I made a dict of different countries and their WOE_ID...
14
15PLACE_WOE_ID = country_id[country]
16place_trends = twitter_api.trends.place(_id=PLACE_WOE_ID)
17
18Traceback (most recent call last):
19 File "C:/Users/user/Documents/twipgm.py", line 44, in <module>
20 place_trends = twitter_api.trends.place(_id=PLACE_WOE_ID)
21AttributeError: 'API' object has no attribute 'trends'