slackmail/slack/auth.py

20 lines
404 B
Python

#
# Copyright 2015 (c) Anna Schumaker
#
from . import api
# TODO: Move the token config file outside of code directory
__TOKEN = ""
with open("token") as f:
__TOKEN = f.read().strip()
def test():
ret = api.call("auth.test", token = __TOKEN)
if ret["ok"] == False:
print("Authentication error: %s." % ret["error"])
return None
return ret
def token():
return __TOKEN