From 3f992e69eea1f542d206d6d3decb6805ecc15408 Mon Sep 17 00:00:00 2001 From: "masaya.suzuki" Date: Fri, 15 Jul 2022 22:21:27 +0900 Subject: [PATCH 1/2] =?UTF-8?q?amesh=E3=81=AE=E3=82=BF=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E7=94=BB=E5=83=8F=E5=8F=96=E5=BE=97=E6=99=82=E3=81=ABUser=20Ag?= =?UTF-8?q?ent=E3=82=92=E4=BB=98=E4=B8=8E=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/jma_amesh.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/jma_amesh.py b/library/jma_amesh.py index 22d5c04359..c9032665f4 100644 --- a/library/jma_amesh.py +++ b/library/jma_amesh.py @@ -15,6 +15,8 @@ import requests from PIL import Image, ImageEnhance +from slackbot_settings import VERSION + @dataclass class WebMercatorTile: @@ -94,7 +96,7 @@ def get_tile_image( ) res = [] for url in urls: - res.append(Image.open(BytesIO(requests.get(url).content))) + res.append(Image.open(BytesIO(requests.get(url, headers={'user-agent': f'hato-bot/{VERSION}'}).content))) dst_image = Image.new( "RGBA", (256 * (2 * around_tiles + 1), 256 * (2 * around_tiles + 1)) ) From 60e928d55b5b6d1dba4bb8056b4f00006f9a7cdf Mon Sep 17 00:00:00 2001 From: "masaya.suzuki" Date: Fri, 15 Jul 2022 22:29:52 +0900 Subject: [PATCH 2/2] =?UTF-8?q?super-linter=E3=81=AB=E3=82=88=E3=82=8B?= =?UTF-8?q?=E6=8C=87=E6=91=98=E4=BA=8B=E9=A0=85=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/jma_amesh.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/library/jma_amesh.py b/library/jma_amesh.py index c9032665f4..219aaad0d1 100644 --- a/library/jma_amesh.py +++ b/library/jma_amesh.py @@ -14,7 +14,6 @@ import requests from PIL import Image, ImageEnhance - from slackbot_settings import VERSION @@ -96,7 +95,15 @@ def get_tile_image( ) res = [] for url in urls: - res.append(Image.open(BytesIO(requests.get(url, headers={'user-agent': f'hato-bot/{VERSION}'}).content))) + res.append( + Image.open( + BytesIO( + requests.get( + url, headers={"user-agent": f"hato-bot/{VERSION}"} + ).content + ) + ) + ) dst_image = Image.new( "RGBA", (256 * (2 * around_tiles + 1), 256 * (2 * around_tiles + 1)) )