Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ameshのタイル画像取得時にUser Agentを付与する #1229

Merged
merged 2 commits into from
Jul 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion library/jma_amesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import requests
from PIL import Image, ImageEnhance
from slackbot_settings import VERSION


@dataclass
Expand Down Expand Up @@ -94,7 +95,15 @@ 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))
)
Expand Down