class documentation
Class for interacting with a GitHub repository.
Note
To interact with private GitHub repositories that you have access to, provide your GitHub personal access token by setting the GITHUB_TOKEN environment variable.
Parameters | |
repo | the GitHub repository or identifier, which can be:
|
safe | whether to allow repo to contain a tree path like
https://github.com/<user>/<repo>/tree/<branch>/<path>. If
safe=True and a <path> is found, it is extracted and stored
in the safe_path property |
Static Method | parse |
Undocumented |
Static Method | parse |
Undocumented |
Method | __init__ |
Undocumented |
Method | download |
Downloads the repository to the specified root directory. |
Method | get |
Downloads the file at the given path. |
Method | get |
Returns a dict of info about the repository. |
Method | list |
Returns the contents of the repo rooted at the given path. |
Method | list |
Returns a flat list of the repository's contents. |
Property | identifier |
The repository identifier string. |
Property | ref |
The ref (e.g. branch, tag, commit hash), if any. |
Property | repo |
The name of the repo. |
Property | safe |
The path that was extracted from the provided ref, if any. |
Property | user |
The username of the repo. |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _handle |
Undocumented |
Method | _make |
Undocumented |
Instance Variable | _ref |
Undocumented |
Instance Variable | _repo |
Undocumented |
Instance Variable | _safe |
Undocumented |
Instance Variable | _session |
Undocumented |
Instance Variable | _user |
Undocumented |
Downloads the file at the given path.
Parameters | |
path | the filepath in the repository |
outpath:None | a path on disk to write the file |
Returns | |
the file bytes, if no outpath is provided |
Returns the contents of the repo rooted at the given path.
Note
This method has a limit of 1,000 files. Documentation.
Parameters | |
path:None | an optional root path to start the search from |
Returns | |
a list of file info dicts |
Returns a flat list of the repository's contents.
Note
This method has a limit of 100,000 entries and 7MB response size. Documentation.
Parameters | |
recursive:True | whether to recursively traverse subdirectories |
Returns | |
a list of file info dicts |