相关文章推荐
霸气的花卷  ·  python list 错位相减 ...·  1 月前    · 
憨厚的大脸猫  ·  python ...·  1 月前    · 
小猫猫  ·  python tornado ...·  3 周前    · 
有腹肌的充值卡  ·  pycharm console 清屏 ...·  6 天前    · 
失眠的匕首  ·  中苏关系 - 知乎·  10 月前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=49426):

Ask Question

I am writing a bot that must execute scripts at a specific time. The first script runs well, but the second doesn't want to. Throws this error urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=50039): Max retries exceeded with url: /session/ff59b4e8d80282f58c766e631996b3b3/window (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001DDDCEDF1C0>: Failed to establish a new connection: [WinError 10061].

My code

from selenium import webdriver
import time
import schedule
options = webdriver.ChromeOptions()
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("user-data-dir=./chromeprofile")
options.add_argument('--disable-extensions')
# options.add_argument("--incognito")
options.add_argument("--disable-plugins-discovery")
options.add_argument("--start-maximized")
driver = webdriver.Chrome(r'C:\Users\Ilya\PycharmProjects\University_BOT\Chrome\chromedriver.exe', options=options)
url = 'https://meet.google.com/lookup/gy7njx5dia?authuser=1&hs=179'
''' first_second_lesson_monday
first - Номер тижня
second - пара по счоту
first_monday = {
    'IT' :  'https://meet.google.com/urb-rjsp-wqm',
    'Urkaine_Language': 'https://meet.google.com/lookup/axjfog62dw?authuser=1&hs=179'
def second_first_lesson_wednesday():
        driver.get(url = 'https://meet.google.com/urb-rjsp-wqm' )
        time.sleep(3)
        off_micro = driver.find_element_by_xpath('//div[@class="U26fgb JRY2Pb mUbCce kpROve uJNmj QmxbVb HNeRed"]').click()
        time.sleep(4)
        off_cam = driver.find_elements_by_xpath('//span[@class="DPvwYc JnDFsc dMzo5"]')
        off_cam[1].click()
        time.sleep(4)
        press_coninue = driver.find_element_by_xpath('//span[@class="NPEfkd RveJvd snByac"]').click()
        time.sleep(60)
    except Exception as ex:
        print(ex)
    finally:
        driver.close()
        driver.quit()
schedule.every().day.at("13:28").do(second_first_lesson_wednesday)
def second_second_lesson_wednesday():
        driver.get(url= 'https://meet.google.com/lookup/hvug6sxjey?authuser=1&hs=179')
        time.sleep(3)
        off_micro = driver.find_element_by_xpath('//div[@class="U26fgb JRY2Pb mUbCce kpROve uJNmj QmxbVb HNeRed"]').click()
        time.sleep(4)
        off_cam = driver.find_elements_by_xpath('//span[@class="DPvwYc JnDFsc dMzo5"]')
        off_cam[1].click()
        time.sleep(4)
        press_coninue = driver.find_element_by_xpath('//span[@class="NPEfkd RveJvd snByac"]').click()
        time.sleep(40)
    except Exception as ex:
        print(ex)
    finally:
        driver.close()
        driver.quit()
schedule.every().day.at("14:35").do(second_second_lesson_wednesday)
def second_third_lesson_wednesday():
        driver.get(url='https://meet.google.com/lookup/e6kettrs2b?authuser=1&hs=179')
        time.sleep(3)
        off_micro = driver.find_element_by_xpath('//div[@class="U26fgb JRY2Pb mUbCce kpROve uJNmj QmxbVb HNeRed"]').click()
        time.sleep(4)
        off_cam = driver.find_elements_by_xpath('//span[@class="DPvwYc JnDFsc dMzo5"]')
        off_cam[1].click()
        time.sleep(4)
        press_coninue = driver.find_element_by_xpath('//span[@class="NPEfkd RveJvd snByac"]').click()
        time.sleep(30)
    except Exception as ex:
        print(ex)
    finally:
        driver.close()
        driver.quit()
schedule.every().day.at("14:39").do(second_third_lesson_wednesday)
while True:
    schedule.run_pending()
    time.sleep(1)

First the error you're facing means that the script can't access the url. This could be because of an SSL certificate, google meet doesn't support bots, or some other reason relating to your network. Most likely because of the timeout like in this thread I would suggest using webbot instead of selenium as it's more versatile or using the suggestions in the other thread.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.