ref(YandexMap): add initial_coordinates
This commit is contained in:
@@ -12,15 +12,23 @@ from selenium import webdriver
|
|||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.common.action_chains import ActionChains
|
from selenium.webdriver.common.action_chains import ActionChains
|
||||||
|
|
||||||
def generateURL(lat=49.103814, lon=55.794258, zoom=10):
|
def generateURL(lat: float, lon: float, zoom: int):
|
||||||
return f"https://yandex.ru/maps/43/kazan/?l=sat&ll={lat}%2C{lon}&z={zoom}"
|
return f"https://yandex.ru/maps/43/kazan/?l=sat&ll={lat}%2C{lon}&z={zoom}"
|
||||||
|
|
||||||
class YandexMap:
|
class YandexMap:
|
||||||
def __init__(self):
|
initial_zoom: int
|
||||||
|
initial_lat: float
|
||||||
|
initial_lon: float
|
||||||
|
|
||||||
|
def __init__(self, initial_lat=49.103814, initial_lon=55.794258, initial_zoom=10):
|
||||||
|
self.initial_lat = initial_lat
|
||||||
|
self.initial_lon = initial_lon
|
||||||
|
self.initial_zoom = initial_zoom
|
||||||
|
|
||||||
options = webdriver.ChromeOptions()
|
options = webdriver.ChromeOptions()
|
||||||
# options.add_experimental_option("detach", True)
|
# options.add_experimental_option("detach", True)
|
||||||
self.driver = webdriver.Chrome(options)
|
self.driver = webdriver.Chrome(options)
|
||||||
self.driver.get(generateURL())
|
self.driver.get(generateURL(initial_lat, initial_lon, initial_zoom))
|
||||||
self.driver.maximize_window()
|
self.driver.maximize_window()
|
||||||
sleep(2)
|
sleep(2)
|
||||||
|
|
||||||
@@ -107,4 +115,4 @@ class YandexMap:
|
|||||||
cropped_image = image[y1:y2, x1:x2]
|
cropped_image = image[y1:y2, x1:x2]
|
||||||
|
|
||||||
# Если нужно вернуть изображение как результат функции:
|
# Если нужно вернуть изображение как результат функции:
|
||||||
return cropped_image
|
return cropped_image
|
||||||
|
|||||||
Reference in New Issue
Block a user