|
|
@ -51,22 +51,23 @@ class PublicRelations(Bureau):
|
|
|
|
self.auth = twitter.OAuth(oauth_token, oauth_secret, CK, CS)
|
|
|
|
self.auth = twitter.OAuth(oauth_token, oauth_secret, CK, CS)
|
|
|
|
self.t.t = twitter.Twitter(auth=self.auth)
|
|
|
|
self.t.t = twitter.Twitter(auth=self.auth)
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: expand config to have other masto servers
|
|
|
|
|
|
|
|
MASTO_CREDS = os.path.expanduser('~/.screenless/masto_creds')
|
|
|
|
|
|
|
|
if not os.path.exists(MASTO_CREDS):
|
|
|
|
|
|
|
|
Mastodon.create_app('screenless',
|
|
|
|
|
|
|
|
api_base_url='https://mastodon.social',
|
|
|
|
|
|
|
|
to_file=MASTO_CREDS)
|
|
|
|
|
|
|
|
# TODO: catch the error when our token is too old and throw it out
|
|
|
|
|
|
|
|
self.masto = Mastodon(client_id=MASTO_CREDS,
|
|
|
|
|
|
|
|
api_base_url='https://mastodon.social')
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|
|
|
|
MASTO_CREDS = os.path.expanduser('~/.screenless/masto_creds')
|
|
|
|
|
|
|
|
masto_server = self.config["mastodon"]["server"]
|
|
|
|
|
|
|
|
if not os.path.exists(MASTO_CREDS):
|
|
|
|
|
|
|
|
Mastodon.create_app('screenless',
|
|
|
|
|
|
|
|
api_base_url=masto_server,
|
|
|
|
|
|
|
|
to_file=MASTO_CREDS)
|
|
|
|
|
|
|
|
# TODO: catch the error when our token is too old and throw it out
|
|
|
|
|
|
|
|
self.masto = Mastodon(client_id=MASTO_CREDS,
|
|
|
|
|
|
|
|
api_base_url=masto_server)
|
|
|
|
masto_user = self.config["mastodon"]["user"]
|
|
|
|
masto_user = self.config["mastodon"]["user"]
|
|
|
|
masto_pass = self.config["mastodon"]["password"]
|
|
|
|
masto_pass = self.config["mastodon"]["password"]
|
|
|
|
self.masto.log_in(masto_user, masto_pass)
|
|
|
|
self.masto.log_in(masto_user, masto_pass)
|
|
|
|
except KeyError:
|
|
|
|
except KeyError:
|
|
|
|
print("no mastodon config found.")
|
|
|
|
print("no mastodon config found.")
|
|
|
|
print("you can add a 'mastodon:' section to PR.yml with:")
|
|
|
|
print("you can add a 'mastodon:' section to PR.yml with:")
|
|
|
|
|
|
|
|
print(" server: my.server.name")
|
|
|
|
print(" user: myuser")
|
|
|
|
print(" user: myuser")
|
|
|
|
print(" password: mypassword")
|
|
|
|
print(" password: mypassword")
|
|
|
|
print("skipping masto login for now...")
|
|
|
|
print("skipping masto login for now...")
|
|
|
|