Download file from URL. Parameters ---------- url: URL. Google Drive URL is also supported. output: Output filename/directory. Default is basename of URL. If output is an existing directory or ends with a path separator, the basename will be appended
(
url: str | None = None,
output: str | BinaryIO | None = None,
quiet: bool = False,
proxy: str | None = None,
speed: float | None = None,
use_cookies: bool = True,
verify: bool | str = True,
id: str | None = None,
resume: bool = False,
format: str | None = None,
user_agent: str | None = None,
log_messages: dict[str, str] | None = None,
progress: Callable[[int, int | None], None] | None = None,
skip_download: bool = False,
)
| 140 | |
| 141 | |
| 142 | def download( |
| 143 | url: str | None = None, |
| 144 | output: str | BinaryIO | None = None, |
| 145 | quiet: bool = False, |
| 146 | proxy: str | None = None, |
| 147 | speed: float | None = None, |
| 148 | use_cookies: bool = True, |
| 149 | verify: bool | str = True, |
| 150 | id: str | None = None, |
| 151 | resume: bool = False, |
| 152 | format: str | None = None, |
| 153 | user_agent: str | None = None, |
| 154 | log_messages: dict[str, str] | None = None, |
| 155 | progress: Callable[[int, int | None], None] | None = None, |
| 156 | skip_download: bool = False, |
| 157 | ) -> str | BinaryIO | GoogleDriveFileToDownload: |
| 158 | """Download file from URL. |
| 159 | |
| 160 | Parameters |
| 161 | ---------- |
| 162 | url: |
| 163 | URL. Google Drive URL is also supported. |
| 164 | output: |
| 165 | Output filename/directory. Default is basename of URL. |
| 166 | If output is an existing directory or ends with a path separator, |
| 167 | the basename will be appended automatically. |
| 168 | quiet: |
| 169 | Suppress terminal output. Default is False. |
| 170 | proxy: |
| 171 | Proxy. |
| 172 | speed: |
| 173 | Download byte size per second (e.g., 256KB/s = 256 * 1024). |
| 174 | use_cookies: |
| 175 | Flag to use cookies. Default is True. |
| 176 | verify: |
| 177 | Either a bool, in which case it controls whether the server's TLS |
| 178 | certificate is verified, or a string, in which case it must be a path |
| 179 | to a CA bundle to use. Default is True. |
| 180 | id: |
| 181 | Google Drive's file ID. |
| 182 | resume: |
| 183 | Resume interrupted downloads while skipping completed ones. |
| 184 | Default is False. |
| 185 | format: |
| 186 | Format of Google Docs, Spreadsheets and Slides. Default is: |
| 187 | - Google Docs: 'docx' |
| 188 | - Google Spreadsheet: 'xlsx' |
| 189 | - Google Slides: 'pptx' |
| 190 | user_agent: |
| 191 | User-agent to use in the HTTP request. |
| 192 | log_messages: |
| 193 | Log messages to customize. Currently it supports: |
| 194 | - 'start': the message to show the start of the download |
| 195 | - 'output': the message to show the output filename |
| 196 | progress: |
| 197 | Callback called after each chunk: ``progress(bytes_so_far, bytes_total)``. |
| 198 | *bytes_total* is None when Content-Length is unavailable. |
| 199 | Raise any exception from the callback to abort the download. |
searching dependent graphs…