I want to get the file contents of all the files in the repo [changed and unchanged] using the Python [PyGitHub API]. But not sure how to achieve it. Simply, to browse the repo at that specific commit id in history.
Is there any other API to get the required data? or can be done with PyGitHub itself.
Note: I'm using Github API v3.
Provided you are not downloading a file too large (more than 1MB), as seen in PyGithub/PyGithub/issue 661, the idea is to:
That is:
contents = repository.get_dir_contents(urllib.parse.quote(server_path), ref=sha)
Then:
for content in contents:
if content.type != 'dir':
file_content = repository.get_contents(urllib.parse.quote(content.path), ref=sha)
// or
file_content = repository.get_git_blob(content.sha)