From 628c9a0e9eac05e17cf37378f6417e17a1acdf5f Mon Sep 17 00:00:00 2001 From: Tommy Guy Date: Sun, 19 Apr 2015 20:36:10 -0700 Subject: [PATCH] Fixed key error in some tweets --- tweepy/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tweepy/models.py b/tweepy/models.py index 09ed3eb..0db677e 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -78,7 +78,8 @@ class Status(Model): # I'm not proud. Blame billg. json['text'] = str(json['text'].encode('ascii', 'ignore'))[2:-1] - json['user']['screen_name'] = str(json['user']['screen_name'].encode('ascii', 'ignore'))[2:-1] + if 'user' in json: + json['user']['screen_name'] = str(json['user']['screen_name'].encode('ascii', 'ignore'))[2:-1] setattr(status, '_json', json) for k, v in json.items(): -- 2.39.5