Skip to content

Commit 3f992e6

Browse files
committed
ameshのタイル画像取得時にUser Agentを付与する
1 parent af092b8 commit 3f992e6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

library/jma_amesh.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import requests
1616
from PIL import Image, ImageEnhance
1717

18+
from slackbot_settings import VERSION
19+
1820

1921
@dataclass
2022
class WebMercatorTile:
@@ -94,7 +96,7 @@ def get_tile_image(
9496
)
9597
res = []
9698
for url in urls:
97-
res.append(Image.open(BytesIO(requests.get(url).content)))
99+
res.append(Image.open(BytesIO(requests.get(url, headers={'user-agent': f'hato-bot/{VERSION}'}).content)))
98100
dst_image = Image.new(
99101
"RGBA", (256 * (2 * around_tiles + 1), 256 * (2 * around_tiles + 1))
100102
)

0 commit comments

Comments
 (0)