Wednesday, 15 May 2013

python - Attempting to stream Twitter Timeline with Tweepy but always get unfiltered JSON -



python - Attempting to stream Twitter Timeline with Tweepy but always get unfiltered JSON -

i'm working on python app stream twitter using tweepy. whenever seek stream timeline block of reddish json.

i've checked online extensively , seek yields same results.

def main(): screen_name = '****' ckey = "****" csecret = "****" atoken = "****" asecret = "****" auth = tweepy.oauthhandler(ckey, csecret) auth.set_access_token(atoken, asecret) api = tweepy.api(auth) auth = oauthhandler(ckey, csecret) mainmenu(ckey,csecret,atoken,asecret,auth,api) def mainmenu(ckey,csecret,atoken,asecret,auth,api): print("welcome pytwit app!") option=int(input("please select 1 home timeline, 2 tweet, 3 search. ")) if option==1: tweetstream(ckey,csecret,atoken,asecret,auth,api) elif alternative ==2: posttweet(ckey,csecret,atoken,asecret,api) elif alternative ==3: search() else: print("invalid entry, please seek again.") mainmenu(ckey,csecret,atoken,asecret,auth,api) def tweetstream(ckey,csecret,atoken,asecret,auth,api): screen_name = 'jen_b_mart' auth = oauthhandler(ckey, csecret) stream = api.home_timeline(creen_name = screen_name) decoded = json.dumps(stream, sort_keys=true) print"(%s) %s" % (decoded["created_at"], decoded["text"]) print("\n\n") mainmenu(ckey,csecret,atoken,asecret,auth,api) main()

python json twitter timeline tweepy

No comments:

Post a Comment