From 04ce4c32a0f1c916f02054e24eccbbdc82035ace Mon Sep 17 00:00:00 2001 From: Sandy Perez Matamoros Date: Wed, 30 Dec 2020 13:20:36 -0500 Subject: [PATCH 1/2] Fix #220 --- .vscode/asd | 0 .vscode/settings.json | 3 +++ tc-copy | 4 ++-- tilecloud/store/url.py | 11 +++++++---- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .vscode/asd create mode 100644 .vscode/settings.json diff --git a/.vscode/asd b/.vscode/asd new file mode 100644 index 000000000..e69de29bb diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..d2a6c1275 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/usr/bin/python" +} \ No newline at end of file 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: From f72a19fab67f8d72156a484f09f0050b256917a3 Mon Sep 17 00:00:00 2001 From: Sandy Perez Matamoros Date: Wed, 30 Dec 2020 13:23:30 -0500 Subject: [PATCH 2/2] Removing vscode files from cache --- .vscode/asd | 0 .vscode/settings.json | 3 --- 2 files changed, 3 deletions(-) delete mode 100644 .vscode/asd delete mode 100644 .vscode/settings.json diff --git a/.vscode/asd b/.vscode/asd deleted file mode 100644 index e69de29bb..000000000 diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index d2a6c1275..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "/usr/bin/python" -} \ No newline at end of file