Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ChatBotGroup/version1.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
58 lines (44 sloc)
1.89 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, tweepy, json, webbrowser, urllib | |
#from urllib.parse import urlencode | |
consumer_key = '8FAGQbWAHR3YvgB7qnDbiP6Gc' | |
consumer_secret = '7YdmCRuzWhIpdQBoIN8gfGSS5IHuKKCDivtHb6MSOf7xkFrnGs' | |
access_token = '1057021649701273602-ludjSICdEPAfhmeXBPTbVpBeJvFbJb' | |
access_token_secret = 'OZxlislafuep2hbDMnn7QjNPjeLEGR6m54BoUhcJ5PeAX' | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth) | |
countries = ("London = 1\nNew York = 2\nTokyo = 3\nDubai = 4\nSydney = 5\n") | |
print(countries) | |
choice = int(input("To select a city to view its current trendingTopics, select its corresponding number. \n")) | |
if choice == 1: | |
UK_WOE_ID = 23424975 | |
uk_trends = api.trends_place(UK_WOE_ID) | |
trends = json.loads(json.dumps(uk_trends, indent=1)) | |
for trend in trends[0]["trends"]: | |
print ((trend["name"]).strip("#")) | |
search() | |
elif choice == 2: | |
US_WOE_ID = 2459115 | |
us_trends = api.trends_place(US_WOE_ID) | |
trends = json.loads(json.dumps(us_trends, indent=1)) | |
for trend in trends[0]["trends"]: | |
print ((trend["name"]).strip("#")) | |
elif choice == 3: | |
JP_WOE_ID = 1118108 | |
japan_trends = api.trends_place(JP_WOE_ID) | |
trends = json.loads(json.dumps(japan_trends, indent=1)) | |
for trend in trends[0]["trends"]: | |
print ((trend["name"]).strip("#")) | |
elif choice == 4: | |
UAE_WOE_ID = 1940345 | |
uae_trends = api.trends_place(UAE_WOE_ID) | |
trends = json.loads(json.dumps(uae_trends, indent=1)) | |
for trend in trends[0]["trends"]: | |
print ((trend["name"]).strip("#")) | |
elif choice == 5: | |
AU_WOE_ID = 1105779 | |
au_trends = api.trends_place(AU_WOE_ID) | |
trends = json.loads(json.dumps(au_trends, indent=1)) | |
for trend in trends[0]["trends"]: | |
print ((trend["name"]).strip("#")) | |
git commit |