Modify GitHub Issue bot to use new authentication module.

This commit is contained in:
Vamshi Balanaga 2016-12-23 22:45:34 -05:00 committed by Tim Abbott
parent da256ef854
commit 2a8c57d77a

View file

@ -19,18 +19,11 @@ class IssueHandler(object):
URL = 'https://api.github.com/repos/{}/{}/issues' URL = 'https://api.github.com/repos/{}/{}/issues'
CHARACTER_LIMIT = 70 CHARACTER_LIMIT = 70
CONFIG_FILE = '~/.github-issue-bot/github-issue-bot.conf' CONFIG_FILE = '~/.github-auth.conf'
REPO_NAME = ''
REPO_OWNER = ''
def __init__(self): def __init__(self):
# gets token from config file self.repo_name = github.get_repo()
# Token at CONFIG_FILE address self.repo_owner = github.get_repo_owner()
config = six.moves.configparser.ConfigParser()
config.read([os.path.expanduser(self.CONFIG_FILE)])
self.REPO_NAME = config.get('github', 'github_repo')
self.REPO_OWNER = config.get('github', 'github_repo_owner')
def usage(self): def usage(self):
return ''' return '''
@ -45,11 +38,11 @@ class IssueHandler(object):
with access to public repositories ONLY, with access to public repositories ONLY,
and that the repository name is entered correctly. and that the repository name is entered correctly.
Check ~/.github-issue-bot/github-issue-bot.conf, and make sure there are Check ~/.github-auth.conf, and make sure there are
github_repo (The name of the repo to post to) github_repo = <repo_name> (The name of the repo to post to)
github_repo_owner (The owner of the repo to post to) github_repo_owner = <repo_owner> (The owner of the repo to post to)
github_username (The username of the github bot) github_username = <username> (The username of the GitHub bot)
github_token (The personal access token for the github bot) github_token = <oauth_token> (The personal access token for the GitHub bot)
''' '''
def triage_message(self, message, client): def triage_message(self, message, client):