def authenticate(self): """Connects to Github and Asana and authenticates via OAuth.""" if self.oauth: return False # Save asana. self.settings.apply('api-asana', self.args.asana_api, "enter asana api key") # Save github.com self.settings.apply('api-github', self.args.github_api, "enter github.com token") logging.debug("authenticating asana api.") self.asana = Client.basic_auth(self.settings['api-asana']) self.asana_errors = asana_errors self.asana_me = self.asana.users.me() logging.debug("authenticating github api") self.github = Github(self.settings['api-github']) self.github_user = self.github.get_user() self.oauth = True
def __init__(self, settings): self.settings = settings self.asana = Client.basic_auth(self.settings['api-asana']) self.asana_me = self.asana.users.me() self.github = Github(self.settings['api-github']) self.github_user = self.github.get_user()
from github import Github from asana import Client import getpass githubUsername = raw_input("Enter Your Github Username: "******"Enter Your Github Password: "******"Enter Your Full Github Repository Name (owner/repoName): ") asanaAPIKey = getpass.getpass("Enter Your Asana API Key: ") asanaWorkplaceId = raw_input("Enter Your Asana Workplace ID: ") asanaProjectId = raw_input("Enter Your Asana Project ID: ") asanaClient = Client.basic_auth(asanaAPIKey) github = Github(githubUsername, githubPassword) repo = github.get_repo(githubRepoName) labels = repo.get_labels() tagMapping = {} for label in labels: print(label.name) tagId = asanaClient.tags.create( name = label.name, workspace = asanaWorkplaceId )["id"] tagMapping[label.name] = tagId issues = repo.get_issues() for issue in issues: print(issue.title) taskId = asanaClient.tasks.create(