From: Tommy Guy Date: Mon, 10 Nov 2014 04:16:36 +0000 (-0800) Subject: Changed everything to ASCII. I'm worried we'll lose the forest for the \u1f332 X-Git-Url: https://projects.mako.cc/source/twitter-api-cdsw/commitdiff_plain/30dd074a58c070a2ac07650a5eef9c13c3e773a9?ds=inline Changed everything to ASCII. I'm worried we'll lose the forest for the \u1f332 --- diff --git a/tweepy/models.py b/tweepy/models.py index 1338ab4..9b70070 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -69,6 +69,11 @@ class Status(Model): def parse(cls, api, json): status = cls(api) for k, v in json.items(): + + # Hack by guyrt to fix unicode issues, which we do *not* want to teach. + if isinstance(v, basestring): + v = v.encode('ascii', errors='ignore') + if k == 'user': user_model = getattr(api.parser.model_factory, 'user') if api else User user = user_model.parse(api, v) diff --git a/twitter-stream1.py b/twitter-stream1.py index 1127d4a..06f7be0 100644 --- a/twitter-stream1.py +++ b/twitter-stream1.py @@ -1,7 +1,7 @@ import tweepy -from twitter_authentication import API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET +from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET -auth = tweepy.OAuthHandler(API_KEY, API_SECRET) +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) api = tweepy.API(auth) diff --git a/twitter-stream2.py b/twitter-stream2.py index 59e0cf2..ce905ea 100644 --- a/twitter-stream2.py +++ b/twitter-stream2.py @@ -1,7 +1,7 @@ import tweepy -from twitter_authentication import API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET +from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET -auth = tweepy.OAuthHandler(API_KEY, API_SECRET) +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) api = tweepy.API(auth) diff --git a/twitter1.py b/twitter1.py index fe0791d..cee5967 100644 --- a/twitter1.py +++ b/twitter1.py @@ -1,7 +1,7 @@ import tweepy -from twitter_authentication import API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET +from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET -auth = tweepy.OAuthHandler(API_KEY, API_SECRET) +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) api = tweepy.API(auth) diff --git a/twitter2.py b/twitter2.py index 44197e6..b00b0f7 100644 --- a/twitter2.py +++ b/twitter2.py @@ -1,7 +1,7 @@ import tweepy -from twitter_authentication import API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET +from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET -auth = tweepy.OAuthHandler(API_KEY, API_SECRET) +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) api = tweepy.API(auth) diff --git a/twitter3.py b/twitter3.py index aced2be..897b7b3 100644 --- a/twitter3.py +++ b/twitter3.py @@ -1,7 +1,7 @@ import tweepy -from twitter_authentication import API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET +from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET -auth = tweepy.OAuthHandler(API_KEY, API_SECRET) +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) api = tweepy.API(auth) diff --git a/twitter4.py b/twitter4.py index b588b1c..26d4027 100644 --- a/twitter4.py +++ b/twitter4.py @@ -1,7 +1,7 @@ import tweepy -from twitter_authentication import API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET +from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET -auth = tweepy.OAuthHandler(API_KEY, API_SECRET) +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) api = tweepy.API(auth) diff --git a/twitter_authentication.py b/twitter_authentication.py index 22655df..141d774 100644 --- a/twitter_authentication.py +++ b/twitter_authentication.py @@ -1,4 +1,5 @@ -API_KEY = 'CHANGE_ME' -API_SECRET = 'CHANGE_ME' +CONSUMER_KEY = 'CHANGE_ME' +CONSUMER_SECRET = 'CHANGE_ME' ACCESS_TOKEN = 'CHANGE_ME' ACCESS_TOKEN_SECRET = 'CHANGE_ME' +