Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
2336b8cf
Commit
2336b8cf
authored
Oct 14, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pages to api query
parent
93d7204e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
playbooks/roles/gh_mirror/files/repos_from_orgs.py
+13
-8
No files found.
playbooks/roles/gh_mirror/files/repos_from_orgs.py
View file @
2336b8cf
...
...
@@ -43,14 +43,19 @@ def refresh_cache():
repos
=
[]
for
org
in
orgs
:
r
=
requests
.
get
(
'https://api.github.com/users/{}/repos'
.
format
(
org
))
org_data
=
r
.
json
()
for
repo_data
in
org_data
:
if
'html_url'
in
repo_data
:
repos
.
append
({
'html_url'
:
repo_data
[
'html_url'
],
'name'
:
repo_data
[
'name'
],
'org'
:
repo_data
[
'owner'
][
'login'
]})
page
=
1
while
True
:
r
=
requests
.
get
(
'https://api.github.com/users/{}/repos?page={}'
.
format
(
org
,
page
))
org_data
=
r
.
json
()
# request pages until we get zero results
if
not
isinstance
(
org_data
,
list
)
or
len
(
org_data
)
==
0
:
break
for
repo_data
in
org_data
:
if
'html_url'
in
repo_data
:
repos
.
append
({
'html_url'
:
repo_data
[
'html_url'
],
'name'
:
repo_data
[
'name'
],
'org'
:
repo_data
[
'owner'
][
'login'
]})
page
+=
1
with
open
(
'/var/tmp/repos.json'
,
'wb'
)
as
f
:
f
.
write
(
json
.
dumps
(
repos
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment