data.webtools.download_tarball_private¶
Function ยท Source
mdnc.data.webtools.download_tarball_private(
user, repo, tag, asset,
path='.', mode='auto', token=None, verbose=False
)
Download an online tarball from a Github release asset, and extract it automatically (private).
This tool should only be used for downloading assets from private repositories. Although it could be also used for public repositories, we do not recommend to use it in those cases, because it would still require a token even the repository is public.
Now supports gz
, bz2
or xz
format, see tarfile to view the details.
Warning
Using the general interface mdnc.data.webtools.download_tarball
is more recommended.
Arguments¶
Requries
Argument | Type | Description |
---|---|---|
user | str | The Github owner name of the repository, could be an organization. |
repo | str | The Github repository name. |
tag | str | The Github release tag where the data is uploaded. |
asset | str | The github asset (tarball) name (including the file name postfix) to be downloaded. |
path | str | The extracted data root path. Should be a folder path. |
mode | str | The mode of extraction. Could be 'gz' , 'bz2' , 'xz' or 'auto' . When using 'auto' , the format would be guessed by the posfix of the file name in the link. |
token | str | A given OAuth token. Only when this argument is unset, the program will try to find a token from enviornmental variables. To learn how to set the token, please refer to mdnc.data.webtools.get_token . |
verbose | bool | A flag, whether to show the downloaded size during the web request. |
Examples¶
Example
1 2 3 |
|
data.webtools: A Github OAuth token is required for downloading the data in private repository. Please provide your OAuth token:
Token:****************************************
data.webtools: Tips: specify the environment variable $GITTOKEN or $GITHUB_API_TOKEN could help you skip this step.
Get test-datasets-1.tar.xz: 216B [00:00, 217kB/s]
Last update: March 14, 2021