Compare commits
2 Commits
7035fe69dc
...
d68783ddda
Author | SHA1 | Date | |
---|---|---|---|
d68783ddda | |||
3619a6ec0c |
7
news/Dockerfile
Normal file
7
news/Dockerfile
Normal 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"]
|
@ -1,5 +1,7 @@
|
||||
beautifulsoup4
|
||||
pandas
|
||||
psycopg2
|
||||
python-dotenv
|
||||
requests
|
||||
schedule
|
||||
sqlalchemy
|
16
news/update_news.py
Normal file
16
news/update_news.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user