diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2019-05-08 14:14:37 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2019-05-08 14:14:37 -0300 |
commit | 3719637cf414560b078f23a059ec4de4da7e7fd8 (patch) | |
tree | 9436ceff5ae46be4bbc70e2601f6965835723c1b | |
parent | 50dc0f51d5e8c39a444c55c4a2dc244a3672b030 (diff) | |
download | ckandumper-3719637cf414560b078f23a059ec4de4da7e7fd8.tar.gz ckandumper-3719637cf414560b078f23a059ec4de4da7e7fd8.tar.bz2 |
Limit rate per download
-rwxr-xr-x | ckandumper | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -36,9 +36,12 @@ class ckandumper: self.tag_list = '/api/3/action/tag_list' self.tag_show = '/api/3/action/tag_show?' + if args.limit_rate != None + self.limit_rate = '--limit-rate=' + args.limit_rate + # Using wget as it is more reliable def download(self, url, local_filename): - subprocess.call('/usr/bin/wget -c -O "' + local_filename + '" ' + url, shell=True) + subprocess.call('/usr/bin/wget ' + self.limit_rate + ' -c -O "' + local_filename + '" ' + url, shell=True) def ensuredir(self, dest): # Ensure that the destination folder exists @@ -128,6 +131,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description='Dump CKAN metadata and datasets.') parser.add_argument('url', nargs='+', help='CKAN instance URL') parser.add_argument('dest', nargs='+', help='Destination folder') + parser.add_argument("--limit-rate", help="Limit the download speed to amount bytes per second, per download") args = parser.parse_args() # Dispatch |