Answer the question
In order to leave comments, you need to log in
Selenium not working on heroku?
Hello, let's go straight to my settings.
In code:
from selenium import webdriver
op = webdriver.ChromeOptions()
op.binary_location = os.environ.get('GOOGLE_CHROME_BIN')
op.add_argument('--headless')
op.add_argument('--no-sandbox')
op.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(executable_path=os.environ.get('CHROMEDRIVER_PATH'), options=op)
/app/.heroku/python/lib/python3.9/site-packages/selenium/webdriver/firefox/firefox_profile.py:208: SyntaxWarning: "is" with a literal. Did you mean "=="?
if setting is None or setting is '':
async def crawl_data(link: str) -> Union[dict, None, str]:
driver.get(link)
# сюда поток все равно не доползает
soup = BeautifulSoup(driver.page_source, 'html.parser')
# ....
async def tasks_distribution(link: str, wait_duration: int) -> None:
while True:
data = await crawl_data(link)
if data == settings.PINNACLE_LATE:
return None
elif data:
message_text = data['commands'] + '\n\n' + data['link']
await parser.send_message(chat_id=settings.OWNER_ID, text=message_text)
return None
await asyncio.sleep(wait_duration)
@dp.message_handler()
async def listening_to_links(message: Message):
await tasks_distribution(message.text, 60)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question