Skip to content

Commit 696fc68

Browse files
author
root
committed
Updated ActiveGithub.py to use GitHub API v4
1 parent 7dd261e commit 696fc68

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
All major and minor version changes will be documented in this file. Details of
33
patch-level version changes can be found in [commit messages](../../commits/master).
44

5+
## 2020.5 - 2020/02/26
6+
- Updated ActiveGithub.py to use GitHub API v4
7+
58
## 2020.4 - 2020/02/12
69
- Streamlining, use of GitHub API v4 as it offers significant speed improvements
710
(getGithubApiRequest 3.7s to 0.7s per call - 81% speed improvement when getting

lib/githubGraph.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def getRepo(owner, repoName):
109109
name
110110
owner{login}
111111
pushedAt
112+
url
112113
}
113114
}""",
114115
{"owner": owner, "name": repoName})["data"]["repository"]

main/ActiveGithub.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@
55
THISDIR = str(Path(__file__).resolve().parent)
66
sys.path.insert(0, os.path.dirname(THISDIR) + "/lib")
77

8-
import githubREST
8+
import githubGraph
99
import utils
1010

1111
_username, death = utils.getUsernameAndLifespan()
12-
repoName = input("Enter the user and repo name in the form (user/repo - eg. fredhappyface/python.imageround)\n>")
12+
author, repoName = input(
13+
"Enter the user and repo name in the form (user/repo - eg. fredhappyface/python.imageround)\n>"
14+
).split("/")
1315

1416

1517
"""Is source repo alive?
1618
"""
17-
sourceRepo = githubREST.getRepo(repoName)
18-
if githubREST.sourceAlive(sourceRepo, death):
19-
utils.logPrint("Source repo is alive! Head to {}" .format(sourceRepo["html_url"]), "success")
19+
sourceRepo = githubGraph.getRepo(author, repoName)
20+
if githubGraph.sourceAlive(sourceRepo, death):
21+
utils.logPrint("Source repo is alive! Head to {}" .format(sourceRepo["url"]), "success")
2022

2123
"""Get list of forked repos that are alive and newer than the source repo
2224
"""
23-
aliveRepos, forkedRepos = githubREST.getListOfAliveForks(sourceRepo, death)
25+
aliveRepos, forkedRepos = githubGraph.getListOfAliveForks(sourceRepo, death)
2426

2527
utils.logPrint("{} out of {} Forked repos are alive and newer than the source!"
2628
.format(len(aliveRepos), len(forkedRepos)), "bold")
2729
for aliveRepo in aliveRepos:
28-
githubREST.printRepo(aliveRepo)
30+
githubGraph.printRepo(aliveRepo)

0 commit comments

Comments
 (0)