Return false in twishort module if a long tweet has been deleted

This commit is contained in:
Manuel Cortez 2016-10-02 07:52:02 -05:00
parent 2dd262cc83
commit bd2460e42b

View File

@ -35,11 +35,11 @@ def is_long(tweet):
return long return long
def get_full_text(uri): def get_full_text(uri):
# try: try:
r = requests.get("http://api.twishort.com/1.1/get.json", params={"uri": uri, "api_key": keys.keyring.get("twishort_api_key")}) 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"] return r.json()["text"]
# except: except:
# return False return False
def create_tweet(user_token, user_secret, text, media=0): 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) twitter = OAuth1Session(keys.keyring.get("api_key"), client_secret=keys.keyring.get("api_secret"), resource_owner_key=user_token, resource_owner_secret=user_secret)