diff --git a/plugins/github.py b/plugins/github.py index 8b2078e..a6b6acf 100644 --- a/plugins/github.py +++ b/plugins/github.py @@ -3,13 +3,16 @@ import os -list_of_pull_requests=[] +list_of_pull_requests = [] + + +def get_pull_requests(username, repository): -def get_pull_requests(username,repository): github_url = "https://api.github.com" - r = requests.get(os.path.join(github_url, "repos", username, repository, "pulls")) + r = requests.get(os.path.join(github_url, "repos", repository, "pulls")) js = json.loads(r.content) - for i in range(0, len(js)): - if 'title' in js[i].keys(): - list_of_pull_requests.append(js[i]['title']) + for pull in js: + if username == pull['user']['login']: + if 'title' in pull.keys(): + list_of_pull_requests.append(pull['title']) return list_of_pull_requests