download
gen_download_cmd
-
Description: Generates the command to download a file from Google Drive.
-
Parameters
- file_id (
str
): The file ID. - target (
str
): The target path to save the downloaded file.
- file_id (
-
Example
import capybara as cb
file_id = '1c1b9b1b0cdcwfjowief'
target = 'example.txt'
cmd = cb.gen_download_cmd(file_id, target)
print(cmd)
# >>> wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget
# >>> --quiet
# >>> --save-cookies /tmp/cookies.txt
# >>> --keep-session-cookies
# >>> --no-check-certificate 'https://docs.google.com/uc?export=download&id=1c1b9b1b0cdcwfjowief'
# >>> -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1c1b9b1b0cdcwfjowief" -O example.txt && rm -rf /tmp/cookies.txt
download_from_docsaid
download_from_docsaid(file_id: str, file_name: str, target: str) -> None
-
Description: Downloads data from Docsaid's private cloud.
-
Parameters
- file_id (
str
): The file ID. - file_name (
str
): The file name. - target (
str
): The target path to save the downloaded file.
- file_id (
-
Example
import capybara as cb
file_id = 'c1b9b1b0cdcwfjowief'
file_name = 'example.txt'
target = 'example.txt'
cb.download_from_docsaid(file_id, file_name, target)