[PYTHON] Get Redmine User list with DataFrame

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

Get Redmine User list with DataFrame
Get one column from DataFrame with DataFrame
Get a list of IAM users with Boto3
[google-oauth] Get user information
How to get a logged-in user with Django's forms.py
Get started with MicroPython
Get a list created by a user other than yourself
Get Tweets with Tweepy
Get started with Mezzanine
[Python] Get user information and article information with Qiita API
Initialize list with python
Get a list of purchased DMM eBooks with Python + Selenium
Get Python list elements with multiple indexes (number) Simple method
Get country code with python
Get started with Django! ~ Tutorial ⑤ ~
Get started with influxDB + Grafana
Get Youtube data with python
Get information with zabbix api
Get started with Django! ~ Tutorial ④ ~
Get started with Django! ~ Tutorial ⑥ ~
Get thread ID with python
Get started with Python! ~ ② Grammar ~
Get image features with OpenCV
Get stock price with Python
Get home directory with python
Get keyboard events with python
Get Alembic information with Python
Get another tab with pyppeteer
Get ranking with Rakuten API
Get a list of files in a folder with python without a path