From: Benjamin Mako Hill Date: Tue, 5 May 2015 00:15:57 +0000 (-0700) Subject: fixed bugs and python3 updates for the twitter projects X-Git-Url: https://projects.mako.cc/source/twitter-api-cdsw-solutions/commitdiff_plain/1b5bb6edc34a0c0f3b4e3b97a7df8aa709ba9c9e fixed bugs and python3 updates for the twitter projects --- diff --git a/twitter2.py b/twitter2.py index 89f03fa..6d67a0f 100644 --- a/twitter2.py +++ b/twitter2.py @@ -13,6 +13,6 @@ print(user.screen_name + " has " + str(user.followers_count) + " followers.") print("They include these 100 people:") -for friend in user.friends(count=100): +for friend in user.followers(count=100): print(friend.screen_name) diff --git a/twitter4.py b/twitter4.py index 918b565..3030edf 100644 --- a/twitter4.py +++ b/twitter4.py @@ -8,8 +8,7 @@ auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) api = tweepy.API(auth) # code to write the file -import codecs -output_file = codecs.open("MY_DATA.tsv", "w", "utf-8") +output_file = open("MY_DATA.tsv", "w", encoding="utf-8") public_tweets = api.search("data science", count=10)