aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-05-08 14:14:37 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-05-08 14:14:37 -0300
commit3719637cf414560b078f23a059ec4de4da7e7fd8 (patch)
tree9436ceff5ae46be4bbc70e2601f6965835723c1b
parent50dc0f51d5e8c39a444c55c4a2dc244a3672b030 (diff)
downloadckandumper-3719637cf414560b078f23a059ec4de4da7e7fd8.tar.gz
ckandumper-3719637cf414560b078f23a059ec4de4da7e7fd8.tar.bz2
Limit rate per download
-rwxr-xr-xckandumper6
1 files changed, 5 insertions, 1 deletions
diff --git a/ckandumper b/ckandumper
index c85a53d..1ec05d3 100755
--- a/ckandumper
+++ b/ckandumper
@@ -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