diff --git a/tc-copy b/tc-copy index a1a293e57..543f73da8 100755 --- a/tc-copy +++ b/tc-copy @@ -78,7 +78,7 @@ def main(argv): else: tilestream = input_tilestore.list() if options.i is not None and options.n is not None: - tilestream = imap(EveryNth(options.n, options.i), tilestream) + tilestream = map(EveryNth(options.n, options.i), tilestream) if options.randomize: tilestream = list(tilestream) random.shuffle(tilestream) @@ -90,7 +90,7 @@ def main(argv): tilestream = map(benchmark.sample(), tilestream) tilestream = input_tilestore.get(tilestream) if benchmark: - tilestream = imap(benchmark.sample("get"), tilestream) + tilestream = map(benchmark.sample("get"), tilestream) for i, g in enumerate(generate): tilestream = g.get(tilestream) if options.benchmark: diff --git a/tilecloud/store/url.py b/tilecloud/store/url.py index b977c8d7d..3491aa827 100644 --- a/tilecloud/store/url.py +++ b/tilecloud/store/url.py @@ -35,10 +35,13 @@ def get_one(self, tile): tile.content_type = response.headers.get("Content-Type") if response.status_code < 300: tile.data = response.content - if tile.content_type.startswith("image/"): - tile.data = response.content - else: - tile.error = response.text + if tile.content_type: + if tile.content_type.startswith("image/"): + tile.data = response.content + else: + tile.error = response.text + elif response.status_code != 200: + tile.error = "Unable to read content type {0}".format(title.content_type) else: tile.error = response.reason except requests.exceptions.RequestException as e: