How to use the watchtower._config.get_API_token function in watchtower

To help you get started, we’ve selected a few watchtower examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github docathon / docathon / src / watchtower / update_project_database.py View on Github external
help="Path to projects signup questionnaire")
parser.add_argument("--auth", default="GITHUB_API")
parser.add_argument("--outdir", "-o", default="build")
parser.add_argument("--per_page", "-n", default=100)
parser.add_argument("--max_pages", "-m", default=100)
parser.add_argument("--since", "-s", default="2017-01-01",
                    help="Date from which to search, YYYY-MM-DD")

args = parser.parse_args()

# Generate the github API user:token pair
# auth_user = args.auth_user
# auth_token = get_API_token(args.auth_token)
# auth = ':'.join([auth_user, auth_token])
# XXX should fix this to have choldgraf's technic work on travis
auth = get_API_token(args.auth)

per_page = args.per_page,
max_pages = args.max_pages
since = args.since

# Load data from google drive questionnaire
projects = pd.read_csv(args.filename)
# Pull user/project info
columns = ['Github organization and project (if applicable)', 'branch']
projects = projects[columns].values
# Remove missing projects
projects = [ii.split('/') + [br] for ii, br in projects if isinstance(ii, str)]
# Remove non GH projects
projects = [ii for ii in projects if len(ii) == 3]

# Iterate projects and retrieve its latest info
github docathon / docathon / src / watchtower / calculate_diff_stats.py View on Github external
def get_diff(user, proj, sha1, sha2, auth=None):
    """Get the diff between two hashes for a project."""
    auth = get_API_token(auth)
    auth = colon_seperated_pair(auth)
    url = 'http://api.github.com/repos/{user}/{proj}/compare/{sha1}...{sha2}'
    url = url.format(user=user, proj=proj, sha1=sha1, sha2=sha2)
    resp = requests.get(url, auth=auth)
    return resp