diff --git a/screenless/bureau/publicrelations/publicrelations.py b/screenless/bureau/publicrelations/publicrelations.py index 8e870c3..a54b0e8 100644 --- a/screenless/bureau/publicrelations/publicrelations.py +++ b/screenless/bureau/publicrelations/publicrelations.py @@ -1,4 +1,6 @@ +import codecs import html +import os.path import textwrap import urllib @@ -26,13 +28,23 @@ class PublicRelations(Bureau): def __init__(self): Bureau.__init__(self) - self.auth = twitter.OAuth( - "423391766-bhjHwzD1eJfxB9s7ZvmeHReNVJM0d93kJ8KSrHEZ", - "qSvSYMs4lpSKbZtiuOjB1Gon5rzye8whvadcOdDpFocwa", - "arI4UCnfMeKZwAnyvJJIHVnUN", - "agrtzvh3eqSNlZpmPJZ0otclqSUjLKI3JrqugCPrp1Ch9dqsTl") + + CK = codecs.decode("arI4UCnfMeKZwAnyvJJIHVnUN", + "rot13") + CS = codecs.decode("ntegmiu3rdFAyMczCWM0bgpydFHwYXV3WedhtPCec1Pu9qdfGy", + "rot13") + + + TW_CREDS = os.path.expanduser('~/.screenless/tw_creds') + if not os.path.exists(TW_CREDS): + twitter.oauth_dance("The Screenless Office", CK, CS, + TW_CREDS) + + oauth_token, oauth_secret = twitter.read_token_file(TW_CREDS) + self.t = TWrapper() - self.t.t = twitter.Twitter(auth=self.auth) + self.t.t = twitter.Twitter(auth=twitter.OAuth(oauth_token, oauth_secret, + CK, CS)) @add_command("tweetpic", "Post a Document Camera Image to Twitter") def tweet_pic(self):