добавил отправку variant_map и красоты немножко
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user