DEM¶
Copyright (c) 2023-2024 Jianfeng Zhu. All rights reserved.
download_by_stream(url, file_name)
¶
通过stream下载url链接文件
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url |
str
|
url链接 |
required |
file_name |
str
|
文件的本地存储地址 |
required |
Source code in hydro_opendata/downloader/downloader.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
download_from_url(url, file_name)
¶
通过url链接下载文件的一般方法
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url |
str
|
url链接 |
required |
file_name |
str
|
文件的本地存储地址 |
required |
Source code in hydro_opendata/downloader/downloader.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
download_sigletasking(url, file_name)
¶
单函数线程下载文件,显示进度条
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url |
str
|
文件链接 |
required |
file_name |
str
|
文件名或文件路径 |
required |
Source code in hydro_opendata/downloader/downloader.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
unzip_file(zip_path, output_folder=None)
¶
Unzips a ZIP file.
Parameters: - zip_path (str): The path to the ZIP file. - output_folder (str, optional): The folder where the ZIP file should be extracted to. Defaults to a folder named after the ZIP file in the ZIP file's directory.
Returns: - str: The path to the extracted folder.
Source code in hydro_opendata/downloader/downloader.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
wget_download(url, save_path=None)
¶
Downloads a file using wget.
Parameters: - url (str): The URL of the file to be downloaded. - save_path (str, optional): dir or file to save (default: current working directory).
Returns: - str: The path to the downloaded file.
Source code in hydro_opendata/downloader/downloader.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
Last update:
2023-08-30