printer.print_check() else: if result.get('message') is not None: printer.print_error(result['message']) else: printer.print_error('Could not perform merge') sys.exit(-1) else: printer.print_error('Could not find open PR') sys.exit(-1) ################################################################################################### # CLOSE WRIKE TASK ################################################################################################### printer.print_process('Finding issue') issue = github_driver.get_current_issue() if issue.get('number') is None: printer.print_warning('No issue found') else: printer.print_check() printer.print_process('Finding wrike task') matches = re.findall('(https://www\.wrike\.com/(?:open\.htm\?)id=([\d\w]+))', issue.get('body') or '') if len(matches) <= 0: printer.print_warning('No wrike tasks found') else: printer.print_check() for task_tuple in matches: printer.print_process('Completing task {0}'.format(task_tuple[0])) task = wrike_driver.complete_task(task_tuple[1]) if task is not None and task.get('status') is not None and task['status'] == 'Completed':
from GithubAPIDriver import GithubAPIDriver import re import webbrowser driver = GithubAPIDriver() issue = driver.get_current_issue() match = re.search('(https://www\.wrike\.com/(?:open\.htm\?)id=[\d\w]+)', issue.get('body') or '') if match is not None: print match.group(1) webbrowser.open(match.group(1)) else: print 'No wrike task address found'