-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.py
More file actions
73 lines (63 loc) · 3.36 KB
/
Copy pathgithub.py
File metadata and controls
73 lines (63 loc) · 3.36 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import requests
import json
from github_issue import GitHubIssue
def get_issues(org='ngageoint', repo='scale', end_date=None):
"""Returns the issues JSON for the specified org/repo
{
"url": "https://api.github.com/repos/ngageoint/seed-cli/issues/62",
"repository_url": "https://api.github.com/repos/ngageoint/seed-cli",
"labels_url": "https://api.github.com/repos/ngageoint/seed-cli/issues/62/labels{/name}",
"comments_url": "https://api.github.com/repos/ngageoint/seed-cli/issues/62/comments",
"events_url": "https://api.github.com/repos/ngageoint/seed-cli/issues/62/events",
"html_url": "https://github.com/ngageoint/seed-cli/issues/62",
"id": 248411986,
"node_id": "MDU6SXNzdWUyNDg0MTE5ODY=",
"number": 62,
"title": "Identify issues and technologies for standalone Seed CLI",
"labels": [
{
"id": 976187133,
"node_id": "MDU6TGFiZWw5NzYxODcxMzM=",
"url": "https://api.github.com/repos/ngageoint/seed-cli/labels/on%20hold",
"name": "on hold",
"color": "ed0264",
"default": false,
"description": "issues being deferred for later"
}
],
"state": "open",
"locked": false,
"assignee": null,
"assignees": [],
"milestone": null,
"comments": 0,
"created_at": "2017-08-07T13:30:49Z",
"updated_at": "2018-06-26T18:29:49Z",
"closed_at": null,
"author_association": "CONTRIBUTOR",
"body": "Currently the Seed CLI requires a local installation of the Docker engine and CLI. This simplifies things, but requires more domain expertise on the part of the user. If we can get away from this requirement with minimal effort, we should do so.\r\n\r\nWe need to investigate the basic technologies available to us and come up with a reasonable recommendation for moving away from requiring Docker daemon running on host system. Seed CLI should support standalone build / execution of Seed images using technology such as libcontainer, etc.\r\n\r\nI anticipate some likely stumbling blocks:\r\n\r\n* Requirement to support registry auth\r\n* Management of Docker image layers\r\n* Parsing of Dockerfile statements for build\r\n\r\nIf any of these are determined as too big of a development effort, we need to know before we dive in."
}
:param org: The organization to search for
:param repo: The repository name to search for
:return: JSON list of issues
"""
# Grabs all issues
url = 'https://api.github.com/repos/%s/%s/issues?state=all' % (org, repo)
response = requests.get(url)
if end_date:
url = '%s?since=%s' % (url, end_date)
if response.status_code != 200:
print('%d response when getting issues' % response.status_code)
return
json_issues = json.loads(response.content)
print(len(json_issues))
issues = []
for issue in json_issues:
issues.append(GitHubIssue(issue))
# import pdb; pdb.set_trace()
print(len(issues))
def get_pull_requests(org='ngageoint', repo='scale', end_date=None):
resp = requests.get('https://api.github.com/repos/%s/%s/pulls' % (org, repo))
if resp.status_code == 200:
result = json.loads(resp.content)
print('API response: ', resp.content)