Skip to content

Instantly share code, notes, and snippets.

@rafaeldalsenter
Created June 6, 2020 13:14
Show Gist options
  • Save rafaeldalsenter/1b09993558fb65abeb12729fde9531de to your computer and use it in GitHub Desktop.
Save rafaeldalsenter/1b09993558fb65abeb12729fde9531de to your computer and use it in GitHub Desktop.
import schedule
import time
import datetime
import os
from models.stock import Stock
from scraping import Scraping
from models.quote import Quote
from repo.mongo import Mongo
MINUTES_SCHEDULE = 10
class Heart:
...
def play(self):
print('Robo starting...')
schedule.every(MINUTES_SCHEDULE).minutes.do(self.__scraping_task)
print('Capture links from stocks...')
self.__stocks = self.__return_stocks_from_environ()
self.__scraping.set_urls(self.__stocks)
print(f'Schedule started! ({MINUTES_SCHEDULE} minutes)')
while True:
schedule.run_pending()
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment