Receiving this error in a Docker and Python3.10 Container
An example link is as follow: https://finance.yahoo.com/quote/BABA/options?p=BABA&date=1653004800
Browser closed unexpectedly:
Here is my Dockerfile
FROM python:3.10
RUN apt-get update
# TA-Lib
RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
tar -xvzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib/ && \
./configure && \
make && \
make install && \
cd .. && \
rm -R ta-lib ta-lib-0.4.0-src.tar.gz
COPY requirements.txt /tmp/
COPY data/stocks.csv /tmp/data/stocks.csv
RUN pip install --requirement /tmp/requirements.txt
RUN pip freeze >> /tmp/requirement.txt
RUN pyppeteer-install
CMD ["python", "/tmp/app.py"]
async def async_get_options_chain(ticker, date=None, raw=True, headers={'User-agent': 'Mozilla/5.0'}):
"""Extracts call / put option tables for input ticker and expiration date. If
no date is input, the default result will be the earliest expiring
option chain from the current date.
@param: ticker
@param: date"""
site = options.build_options_url(ticker, date)
browser = await launch({'headless': True, 'options': {'args': ['--no-sandbox', '--disable-setuid-sandbox']}})
page = await browser.newPage()
await page.goto(site)
content = await page.evaluate('document.body.textContent', force_expr=True)
What appears to have solved this issue was not installing it from packages but rather from the Dockerfile. Now I have to solve a timeout issue instead :)
Dockerfile
Python