aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-download-mrr.py
diff options
context:
space:
mode:
Diffstat (limited to 'webmap-download-mrr.py')
-rw-r--r--webmap-download-mrr.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/webmap-download-mrr.py b/webmap-download-mrr.py
index 1f44cf8..2d8612c 100644
--- a/webmap-download-mrr.py
+++ b/webmap-download-mrr.py
@@ -55,6 +55,17 @@ class WMS:
self.url = url
self.version = version
+ def __del__(self):
+ if self.req_count is not None and self.url is not None:
+ self.print_req_count()
+
+ def print_req_count(self, elapsed=None):
+ if elapsed is None:
+ logging.info('%d WMS requests sent to %s', self.req_count, self.url)
+ else:
+ logging.info('%d WMS requests (%.2f req/s) sent to %s', self.req_count,
+ self.req_count/elapsed, self.url)
+
# Send a request to the WMS server
def req(self, request, content_type=None, params={}, max_tries=10, timeout=10):
params2 = {
@@ -639,6 +650,8 @@ def download(dl, dest, dir_fd=None, headers={}, session=requests, progress=None)
raise e
elapsed = time_monotonic() - start
+ wms.print_req_count(elapsed=elapsed)
+ wms.req_count = None
logging.info('%s: Fetched %d features (%s) in %s (%.2f feat/s, %s/s)', dest,
feature_count, common.format_bytes(size),
common.format_time(elapsed),