'how to extract open pull req properties from github using pygithub

I want to send notifications to the owners of old(60 days) open pull requests on github - this will help in making the git repo healthy .

I could manage to extract data of open pull requests from pygithub library using following code . But , I believe there should be a better way - any help in this regard is appreciated

def get_no_of_PRS(repo):

pulls= repo.get_pulls(state='open', sort='created', base='master')
#pulls= repo.get_pulls(state='open') 
       # for all open PR irrespective of base (master or release 
        branches)


pr_num_list=[]
pr_user_list = []
pr_title_list = []
pr_date_list = []
for pr in pulls:
    pr_num_list.append(pr.number)
    pr_user_list.append(pr.user.login)
    pr_title_list.append(pr.title)
    pr_date_list.append(pr.created_at)

repository_dict_info["open_pr_req_list"][repo.name] = pr_num_list
repository_dict_info["open_pr_user_list"][repo.name] = pr_user_list
repository_dict_info["open_pr_title_list"][repo.name] = pr_title_list
repository_dict_info["open_pr_created_date"][repo.name] = pr_date_list
print("check_prints:",repository_dict_info)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source