From bd2460e42b9c0a96a02cdbbe24ec43627625a730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sun, 2 Oct 2016 07:52:02 -0500 Subject: [PATCH] Return false in twishort module if a long tweet has been deleted --- src/long_tweets/twishort.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/long_tweets/twishort.py b/src/long_tweets/twishort.py index 2ba21e3e..92c5c662 100644 --- a/src/long_tweets/twishort.py +++ b/src/long_tweets/twishort.py @@ -35,11 +35,11 @@ def is_long(tweet): return long def get_full_text(uri): -# try: - r = requests.get("http://api.twishort.com/1.1/get.json", params={"uri": uri, "api_key": keys.keyring.get("twishort_api_key")}) - return r.json()["text"] -# except: -# return False + try: + r = requests.get("http://api.twishort.com/1.1/get.json", params={"uri": uri, "api_key": keys.keyring.get("twishort_api_key")}) + return r.json()["text"] + except: + return False def create_tweet(user_token, user_secret, text, media=0): twitter = OAuth1Session(keys.keyring.get("api_key"), client_secret=keys.keyring.get("api_secret"), resource_owner_key=user_token, resource_owner_secret=user_secret)