Although it is a part of the class, it is cut out and described. Comment ... Write properly (TODO)
Because the information retrieval from Resource is a little special I'll write it here.
Please let me know if there is a better way.
    ########################################################    
    #Create user ID list
    ########################################################
    def getAllRedmineUsers(self):
        '''
        Args:
        Returns:
           df:DataFrame Redmine DataFrame that stores all registered users
        Raises:
            TypeError:Defective argument type
            Exception:Exception when registering ID
        Examples:
            >>> df = self.getAllRedmineUsers() 
        Note:
I haven't done a lot of detailed input checks, so
Be careful when using w
        '''
        #registration process
        print(f'Get a list of user IDs')
        try:
            #User acquisition: API
            users = self.redmine.user.all()
        except Exception as e:
            print(f'Failed to get user list')
            print(f'Error details:{e}')
            print()
        else:
            #Extract information from Resource
            _list = []
            for _ in users:
                _list.append(list(_))
            #Process the extracted information
            ##Login ID, name (first,last), ID creation date, last login time extracted
            ##TODO extraction time(Convert GMT) to JST (library is in the company, use it)
            __list = []
            for i in range(len(_list)):
                __list.append([f'{_list[i][5][1]}',
                               f'{_list[i][7][1]} {_list[i][8][1]}',
                               f'{_list[i][10][1]}',
                               f'{_list[i][11][1]}'])
            #DataFrame conversion
            df = pd.DataFrame(__list)
            df.columns = ['LoginID','Name', 'Created','LastLogin']
            return df
                                                                                            ```
        Recommended Posts