-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithubController.py
More file actions
32 lines (28 loc) · 957 Bytes
/
githubController.py
File metadata and controls
32 lines (28 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from github import Github
import logging
import json
class GhClass:
def __init__(self, gh_token, repository=None):
self.gh_token = gh_token
self.repository = None
def get_gh_issues(self, repository):
g = Github(self.gh_token)
repo = g.get_repo(repository)
open_issues = repo.get_issues(state='open')
issue_list = []
for issue in open_issues:
url = "https://github.com/"+repository+"/issues/"+str(issue.number)
values = """
{{
"issue_no": "{0}",
"title": {1},
"repo": "{2}",
"url": "{3}"
}}
"""
title = json.dumps(issue.title)
json_data = json.loads(
values.format(issue.number, title, repository, url))
issue_list.append(json_data)
logging.debug('get_gh_issues: %s', issue_list)
return issue_list