You've already forked PythonLib
mirror of
https://github.com/lifebottle/PythonLib.git
synced 2026-02-13 15:25:50 -08:00
Adding first version of get_pull_requests function
This commit is contained in:
@@ -2,6 +2,7 @@ import os
|
||||
import requests
|
||||
import json
|
||||
import subprocess
|
||||
import pandas as pd
|
||||
|
||||
def get_Releases(org, repo_name, latest=False):
|
||||
|
||||
@@ -29,3 +30,20 @@ def refresh_repo(repo_name):
|
||||
["git", "pull"],
|
||||
cwd=base_path
|
||||
)
|
||||
|
||||
def get_pull_requests(org, repo_name):
|
||||
api_url = "https://api.github.com/repos/{}/{}/pulls?state=all".format(org, repo_name)
|
||||
|
||||
header = {
|
||||
"Accept":"application/vnd.github.v3+json"
|
||||
}
|
||||
|
||||
res = requests.get(api_url)
|
||||
json_res = json.loads(res.text)
|
||||
|
||||
#Taking Top 5 PR
|
||||
top5 = json_res[0:5]
|
||||
|
||||
top5_infos = pd.DataFrame([ [ele['created_at'], ele['title'], ele['state'], ele['user']['login'], ele['url']] for ele in top5], columns = ['Created', 'Title', 'Status', 'User', 'Url'])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user