Compare commits

...

2 Commits

3 changed files with 25 additions and 0 deletions

7
news/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM python:3.11
COPY update_news.py .
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip install --index-url https://dev.moshington.com/api/packages/moshferatu/pypi/simple/ database
RUN pip install --index-url https://dev.moshington.com/api/packages/moshferatu/pypi/simple/ news
CMD ["python", "./update_news.py"]

View File

@ -1,5 +1,7 @@
beautifulsoup4
pandas
psycopg2
python-dotenv
requests
schedule
sqlalchemy

16
news/update_news.py Normal file
View File

@ -0,0 +1,16 @@
import schedule
import time
from database.news import insert
from datetime import date
from news import scrape_news
def update_news_data():
news_data = scrape_news(date.today())
insert(news_data)
if __name__ == '__main__':
schedule.every().day.at('02:00', 'America/Los_Angeles').do(update_news_data)
while True:
schedule.run_pending()
time.sleep(1)