danwallach / github-classroom-utils Goto Github PK
View Code? Open in Web Editor NEWPython tools for instructors working with GitHub Classroom
License: Apache License 2.0
Python tools for instructors working with GitHub Classroom
License: Apache License 2.0
Sometimes we want to just leave the token in the repo, so they're easier to work with and do subsequent pushes. Other times, we want clean repos without any tokens. This should be a command-line flag.
How to replicate*
git clone https://github.com/danwallach/github-classroom-utils/
Update github_token and organization name
python3.7 github_clone_all.py --prefix Ass3 --out Ass3
Github setup:
https://github.com/org/Ass3-Student1
https://github.com/org/Ass3-Student2 .....
error
Cached result for org is missing or outdated
Traceback (most recent call last):
File "github_clone_all.py", line 42, in
filtered_repo_list = query_matching_repos(github_organization, github_prefix, github_token)
File "/private/tmp/github-classroom-utils/github_scanner.py", line 212, in query_matching_repos
result = query_repos_cached(github_organization, github_token, verbose)
File "/private/tmp/github-classroom-utils/github_scanner.py", line 161, in query_repos_cached
github_token, verbose)
File "/private/tmp/github-classroom-utils/github_scanner.py", line 313, in parallel_get_github_endpoint_paged_list
link_header = page1_result.headers["Link"]
File "/usr/local/lib/python3.7/site-packages/requests/structures.py", line 52, in getitem
return self._store[key.lower()][1]
KeyError: 'link'
Fix
The pagination logic in github_scanner appears broken. If the org has only one page then the "link" key in the header is empty. I would push a fix but not sure which other scripts might deal with pagination.
Line 319-328
num_pages = 1 # Default page value
if ("Link" in page1_result.headers):
link_header = page1_result.headers["Link"]
p = re.compile('page=(\d+)>; rel="last"')
m = p.findall(link_header)
if len(m) != 1:
if verbose:
print("Malformed header, didn't have pagination!")
return page1_result.json()
num_pages = int(m[0])
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.