I am trying to download a file and so far have reached here, also looked at https://github.com/PyGithub/PyGithub/issues/661
I have reached here so far.
repo = client.get_repo(GIT_REPO)
contents = repo.get_contents(file_path, ref=GIT_BRANCH)
print (contents) # <-- ContentFile(path="clusters/poc2/test.txt")
file_content = repo.get_contents(urllib.parse.quote(contents.path), ref=GIT_BRANCH)
print (file_content) # <-- ContentFile(path="clusters/poc2/test.txt")
I can use GitAPI to download a file, but just trying out my hands with this package :)
There are two methods, -- first, just use file_content.content which is the contents, which you can write to a file. Secondly, there's file_content.download_url to grab it.
Most helpful comment
There are two methods, -- first, just use
file_content.contentwhich is the contents, which you can write to a file. Secondly, there'sfile_content.download_urlto grab it.