def run(self): success = self._login() if success: # Projects projects = Projects(self.connection) success = projects.request_project_list() if success: self.response = projects.get_data() return True, self.response return False, self.response
def run(self, short_name, description, label): success = self._login() if success: # Projects projects = Projects(self.connection) success = projects.create_project(short_name, description, label) if success: self.response = projects.get_data() return True, self.response return False, self.response
def run(self, project_id, git_fields): success = self._login() if success: # Projects projects = Projects(self.connection) if git_fields == 'all': success = projects.request_git(project_id, GitFields.All) else: success = projects.request_git(project_id, GitFields.Basic) if success: self.response = projects.get_data() return True, self.response return False, self.response
def run(self, project_id, order): success = self._login() if success: # Projects projects = Projects(self.connection) if order == 'descending': success = projects.request_milestones(project_id, Order.Descending) else: success = projects.request_milestones(project_id, Order.Ascending) if success: self.response = projects.get_data() return True, self.response return False, self.response
logging.basicConfig(filename=str1, level=logging.INFO) file_name = './resources/Projects_Names_and_Ids.csv' connection = Connection() auth_token = "tlp-k1-5.c8df505800bc8af2e96b0dcde9d2b68cbc7e85a52d3f69ce34283cefce2abe19" success = connection.set_access_key("https://tuleap.nctr.sd/api", auth_token) # ------------- Extract Project IDs and Names --------------- # if success: Response_Offset = file_len(file_name) if path.exists(file_name) else 0 Response_Length = 50 Response_Limit = 50 while Response_Length == 50: projects = Projects(connection) success = projects.request_project_list(Response_Limit, Response_Offset) projects_dict = dict() if success: project_list = projects.get_data() Response_Length = len(project_list) # ---- Extract IDs and Names from project list in a Dict variable type ---- # for sub in project_list: logging.info('Working on Project: ' + str(sub['id'])) is_active_logic = sub['status'] == 'active' or sub[ 'status'] == 'suspended' if sub['is_template'] == False and is_active_logic:
file_name = './resources/Trackers_Names_and_Ids.csv' auth_token = "tlp-k1-5.c8df505800bc8af2e96b0dcde9d2b68cbc7e85a52d3f69ce34283cefce2abe19" str1 = './logs/Projects_Trackers_Ids' + str(date.today()) + '.log' logging.basicConfig(filename=str1, level=logging.INFO) connection = Connection() success = connection.set_access_key("https://tuleap.nctr.sd/api", auth_token) if success: # Read projects id from file projects/data f = open('./resources/Projects_Names_and_Ids.csv', 'r') reader = csv.reader(f) projects_ids = [int(i[0]) for i in reader] # Projects trackers projects = Projects(connection) loop = 0 for x in projects_ids: logging.info('Project ID: ' + str(x)) success = projects.request_trackers(x, 50, None) if success: tracker_list = projects.get_data() tracker_list = list( filter( lambda i: (i['item_name'] != "story" and i['item_name'] != "sprint" and i['item_name'] != "rel" and i['item_name'] != "epic"), tracker_list)) tracker_id = {sub['id']: sub['label'] for sub in tracker_list} if loop == 0: w = csv.writer(open(file_name, "w"))