Selenium multiprocessing with telebot

При вызове функции селениума с мультипроцессингом выдаёт ошибку:

telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 409. Description: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running

Без multiprocessing, всё работает нормально.

UseSelenium(urls, filename).multi_save()
class UseSelenium:
    def __init__(self, urls: list, filename: str):
        self.urls = urls
        self.filename = filename

    def save_page(self, url):

        options = webdriver.ChromeOptions()
        options.add_argument("user-agent=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0")
        options.add_argument("--disable-blink-features=AutomationControlled")
        #options.add_argument("--headless")

        s = Service(executable_path="chromedriver.exe")

        driver = webdriver.Chrome(options=options, service=s)

        try:
            driver.get(url=url)
            time.sleep(5)
            elem = driver.find_element(By.TAG_NAME, "pre").get_attribute('innerHTML')
            time.sleep(random.randrange(3, 10))
            with open('products/' + self.filename, 'w', encoding='utf-8') as f:
                f.write(elem)
        except Exception as ex:
            print(ex)
        finally:
            driver.close()
            driver.quit()

    def multi_save(self):

        p = Pool(processes=10)
        p.map(UseSelenium.save_page, self.urls)

Ответы (0 шт):