From 56ee0eb06e2c3c507f908f27b7bc613efe259d54 Mon Sep 17 00:00:00 2001 From: Mark Smith Date: Sat, 15 Nov 2014 15:33:35 +0100 Subject: [PATCH] Updated examples to work in Python 3. --- examples/oauth.py | 8 +++++--- examples/streaming.py | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/oauth.py b/examples/oauth.py index 1399f4a..6f08dab 100644 --- a/examples/oauth.py +++ b/examples/oauth.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + import tweepy # == OAuth Authentication == @@ -11,7 +13,7 @@ consumer_key="" consumer_secret="" # The access tokens can be found on your applications's Details -# page located at https://dev.twitter.com/apps (located +# page located at https://dev.twitter.com/apps (located # under "Your access token") access_token="" access_token_secret="" @@ -24,9 +26,9 @@ api = tweepy.API(auth) # If the authentication was successful, you should # see the name of the account print out -print api.me().name +print(api.me().name) # If the application settings are set for "Read and Write" then -# this line should tweet out the message to your account's +# this line should tweet out the message to your account's # timeline. The "Read and Write" setting is on https://dev.twitter.com/apps api.update_status('Updating using OAuth authentication via Tweepy!') diff --git a/examples/streaming.py b/examples/streaming.py index 942d7e8..e80c530 100644 --- a/examples/streaming.py +++ b/examples/streaming.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import, print_function + from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream @@ -18,11 +20,11 @@ class StdOutListener(StreamListener): """ def on_data(self, data): - print data + print(data) return True def on_error(self, status): - print status + print(status) if __name__ == '__main__': l = StdOutListener() -- 2.25.1