добавил отправку variant_map и красоты немножко

This commit is contained in:
2023-01-30 19:09:33 +07:00
parent 1327186099
commit b95d3e4680
2 changed files with 14 additions and 11 deletions
+11 -9
View File
@@ -1,20 +1,22 @@
from io import BytesIO
import requests
from PIL import Image
import time
api_server = "http://static-maps.yandex.ru/1.x/"
lon = "37.530887"
lat = "55.703118"
def get_img_map(delta, cords):
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": "map"
"l": variant_map
}
response = requests.get(api_server, params=params)
response = requests.get("http://static-maps.yandex.ru/1.x/", params=params)
Image.open(BytesIO(
response.content)).save("image.png")