Skip to content

Instantly share code, notes, and snippets.

@axhixh
Created March 27, 2016 02:09
Show Gist options
  • Select an option

  • Save axhixh/d198c6a27c0546ca46a8 to your computer and use it in GitHub Desktop.

Select an option

Save axhixh/d198c6a27c0546ca46a8 to your computer and use it in GitHub Desktop.
Find places for which Twitter has trending topics. Can use the WOEID for the place in the list to get the actual trends.
#!/usr/bin/env python
import json
import tweepy
from tweepy import OAuthHandler
consumer_key = ''
consumer_secret = ''
access_token = ''
access_secret = ''
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)
api = tweepy.API(auth)
places = api.trends_available()
with open('places.json','w') as out:
out.write(json.dumps(places))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment