- deal with non-existent tweet shortcodes

- parse tweet detail parameters properly
workspace
Brendan Howell 7 years ago
parent 8658ba4448
commit 2b2d4741ee

@ -57,7 +57,10 @@ class PublicRelations(Bureau):
""" """
with self.dbenv.begin(db=self.tweetdb) as txn: with self.dbenv.begin(db=self.tweetdb) as txn:
tweetid = txn.get(tweet_hash.encode()) tweetid = txn.get(tweet_hash.encode())
return int(tweetid) if tweetid:
return int(tweetid)
else:
return tweetid
def short_tweet_id(self, tweet_id): def short_tweet_id(self, tweet_id):
""" """
@ -151,8 +154,8 @@ class PublicRelations(Bureau):
""" """
Print detailed tweet info and commands for reply, like, retweet, etc. Print detailed tweet info and commands for reply, like, retweet, etc.
""" """
self.log.debug("got data " + str(data)) shortcode, _ = data.split(".")
tweet_id = self.get_tweet_id(data) tweet_id = self.get_tweet_id(shortcode)
self.log.debug("tweet details for id:" + tweet_id) self.log.debug("tweet details for id:" + tweet_id)
tweet = self.t.t.statuses.show(id=tweet_id) tweet = self.t.t.statuses.show(id=tweet_id)
prn = printer.Usb(0x416, 0x5011, in_ep=0x81, out_ep=0x03) prn = printer.Usb(0x416, 0x5011, in_ep=0x81, out_ep=0x03)

Loading…
Cancel
Save