Make html_for_tweet() cope if a tweet has no entities.

I'm not 100% sure if it's possible any more to get tweet data that doesn't
include entities. I've a feeling it might be, but can't find an example.

However, `html_for_tweet()` currently almost handles a tweet not having
entities, except it throws `UnboundLocalError` because the `text`
variable is declared in the wrong place. This fixes that.
This commit is contained in:
Phil Gyford 2016-04-28 08:59:52 +01:00
parent 885051acdc
commit 8d719f3f72

View file

@ -544,8 +544,9 @@ class Twython(EndpointsMixin, object):
if 'retweeted_status' in tweet:
tweet = tweet['retweeted_status']
text = tweet['text']
if 'entities' in tweet:
text = tweet['text']
entities = tweet['entities']
# Mentions