What is the best way to retrieve a single folder from a github repository in a python script?

Viewed 71

I need to download a single folder from a github repository in a Python 3 script.

  • Listing all raw file URLs to download is tedious and eventual new files would need to be added manually
  • Downloading the whole repository as zip takes rather long; there are lots of unneeded files. [This how I do at the moment]

I have read about web services that do what I would need, such as downgit.github.io, but the problem is that generating the relevant URL and fetching it via urllib.request.urlretrive() downloads the website rather than the actual file.

What can I do? Is there a web service that provides raw file links that I can download as described above?

1 Answers
Related