23 lines
784 B
Python
23 lines
784 B
Python
from io import BytesIO
|
|
import requests
|
|
from PIL import Image
|
|
|
|
|
|
def get_img_map(delta: float, cords: tuple, variant_map: str) -> None:
|
|
"""
|
|
Функция обращается к api yandex и создаёт картинку карты по переданным данным
|
|
|
|
:param delta: float - разрешение карты
|
|
:param cords: tuple - 2 координаты точки
|
|
:param variant_map: str - вариант карты
|
|
:return: None
|
|
"""
|
|
params = {
|
|
"ll": ",".join([str(cords[0]), str(cords[1])]),
|
|
"spn": ",".join([str(delta), str(delta)]),
|
|
"l": variant_map
|
|
}
|
|
response = requests.get("http://static-maps.yandex.ru/1.x/", params=params)
|
|
Image.open(BytesIO(
|
|
response.content)).save("image.png")
|