bytes to strings tapdance

workspace
Brendan Howell 7 years ago
parent 691da15624
commit 529191aad6

@ -64,9 +64,10 @@ class PublicRelations(Bureau):
take a tweet id and return a short alphanumeric code take a tweet id and return a short alphanumeric code
""" """
shortcode = ''.join(random.choice(string.ascii_letters + string.digits) shortcode = ''.join(random.choice(string.ascii_letters + string.digits)
for _ in range(5)).encode() for _ in range(5))
with self.dbenv.begin(db=self.tweetdb, write=True) as txn: with self.dbenv.begin(db=self.tweetdb, write=True) as txn:
txn.put(shortcode, tweet_id.encode()) txn.put(shortcode.encode(), tweet_id.encode())
return shortcode
@add_command("tweetpic", "Post a Document Camera Image to Twitter") @add_command("tweetpic", "Post a Document Camera Image to Twitter")
def tweet_pic(self): def tweet_pic(self):

Loading…
Cancel
Save