在 python 脚本中从 github 存储库检索单个文件夹的最佳方法是什么?

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

我需要在 Python 3 脚本中从 github 存储库下载单个文件夹。

我已经阅读了有关可以满足我需要的 Web 服务,例如 downgit.github.io,但问题是生成相关的 URL 并通过 urllib.request.urlretrive() 获取它会下载网站而不是实际文件。

我能做什么?是否有 Web 服务提供我可以如上所述下载的原始文件链接?

我刚刚找到了一个解决方案:ffspec library may be used to download a single folder from a GitHub repository using Python. See https://sebastianwallkoetter.wordpress.com/2022/01/30/copy-github-folders-using-python/