From 8cdc4a6619b536b9a219b556c99740ba85e01dda Mon Sep 17 00:00:00 2001 From: derAnfaenger Date: Thu, 2 Nov 2017 15:02:28 +0100 Subject: [PATCH] zulip_bots: Remove github helper module. No bot is dependant on this module. No future bot should be dependant on it, since it is not a bot itself and is thus blurring the structure of the bots dir. --- zulip_bots/zulip_bots/bots/github/__init__.py | 0 zulip_bots/zulip_bots/bots/github/github.py | 56 ------------------- 2 files changed, 56 deletions(-) delete mode 100644 zulip_bots/zulip_bots/bots/github/__init__.py delete mode 100644 zulip_bots/zulip_bots/bots/github/github.py diff --git a/zulip_bots/zulip_bots/bots/github/__init__.py b/zulip_bots/zulip_bots/bots/github/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/zulip_bots/zulip_bots/bots/github/github.py b/zulip_bots/zulip_bots/bots/github/github.py deleted file mode 100644 index f9d5e00..0000000 --- a/zulip_bots/zulip_bots/bots/github/github.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -# The purpose of this file is to handle all requests -# to the Github API, which will make sure that all -# requests are to the same account, and that all requests -# authenticated correctly and securely -# The sole purpose of this is to authenticate, and it will -# return the requests session that is properly authenticated -import logging -import os -import requests -import six.moves.configparser - - -# This file contains the oauth token for a github user, their username, and optionally, a repository -# name and owner. All in the format: -# github_repo -# github_repo_owner -# github_username -# github_token -CONFIG_FILE = '~/.github-auth.conf' - -global config -config = six.moves.configparser.ConfigParser() # Sets up the configParser to read the .conf file -config.read([os.path.expanduser(CONFIG_FILE)]) # Reads the config file - - -def auth(): - # Creates and authorises a requests session - session = requests.session() - session.auth = (get_username(), get_oauth_token()) - - return session - - -def get_oauth_token(): - _get_data('token') - - -def get_username(): - _get_data('username') - - -def get_repo(): - _get_data('repo') - - -def get_repo_owner(): - _get_data('repo_owner') - - -def _get_data(key): - try: - return config.get('github', 'github_%s' % (key)) - except Exception: - logging.exception('GitHub %s not supplied in ~/.github-auth.conf.' % (key))