From 6d97045c8ce87eda1700c7c5a9ecd3d94f8e5f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Mon, 8 Feb 2016 13:29:35 -0500 Subject: [PATCH] Use oauth token to create GitHub project if available Make sure you have repo/public_repo and write:org scopes. Change-Id: I773331d2b0051865d783af5024fac1490c64c782 --- jeepyb/cmd/manage_projects.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jeepyb/cmd/manage_projects.py b/jeepyb/cmd/manage_projects.py index f125975..721078e 100644 --- a/jeepyb/cmd/manage_projects.py +++ b/jeepyb/cmd/manage_projects.py @@ -276,9 +276,11 @@ def create_github_project( secure_config = ConfigParser.ConfigParser() secure_config.read(github_secure_config) - # Project creation doesn't work via oauth - ghub = github.Github(secure_config.get("github", "username"), - secure_config.get("github", "password")) + if secure_config.has_option("github", "oauth_token"): + ghub = github.Github(secure_config.get("github", "oauth_token")) + else: + ghub = github.Github(secure_config.get("github", "username"), + secure_config.get("github", "password")) orgs = ghub.get_user().get_orgs() orgs_dict = dict(zip([o.login.lower() for o in orgs], orgs))