poli.core.util.files.download_files_from_github.download_file_from_github_repository#
- poli.core.util.files.download_files_from_github.download_file_from_github_repository(repository_name: str, file_path_in_repository: str, download_path_for_file: str, tag: str = 'master', commit_sha: Optional[str] = None, exist_ok: bool = False, parent_folders_exist_ok: bool = True, verbose: bool = False, strict: bool = True) None #
Download a file from a Github repository.
- Parameters
repository_name (str, required) – The name of the repository (i.e. “user/repo”)
file_path_in_repository (str, required) – path to file in repo
download_path (str, required) – path to download to
tag (str, optional) – tag or branch to download, defaults to master
sha (str, optional) – sha of commit to download, overwrites tag if specified
exists_ok (bool, optional) – whether to overwrite existing files
parent_folders_exist_ok (bool, optional) – whether to create parent folders if they do not exist
verbose (bool, optional) – whether to print progress
strict (bool, optional) – whether to raise exceptions on errors
Warning
This function will use an environment variable called GITHUB_TOKEN_FOR_POLI if it exists. If it does not exist, it will try to download without it. Note that the rate limit is 60 requests per hour for anonymous requests.
To create a GitHub token like this, follow the instructions here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token