I am extracting info from XYZ website and save it to sqlite. I want this process repeat every 15 minutes. So my code:
import numpy as np
import pandas as pd
import datetime
import urllib
from bokeh.models import HoverTool
from collections import OrderedDict
import sqlite3
from sqlalchemy import create_engine
from apscheduler.schedulers.background import BackgroundScheduler
def get_data():
query = ("WEBSITE_ADDRESSCOM/XYZ.json")
raw_data = pd.read_json(query)
conn = sqlite3.connect('X.db')
c = conn.cursor()
disk_engine = create_engine('sqlite:///X.db')
raw_data.to_sql('table', disk_engine, if_exists='append')
print("I downloaded", pd.read_sql_query('SELECT * FROM
table',disk_engine).shape[0],"cases")
conn.close()
scheduler = BackgroundScheduler()
scheduler.add_job(get_data, 'interval', minutes=15)
scheduler.start()
But it gives me this error.
LookupError: No trigger by the name "interval" was found
This code works on Windows. I am trying on Mac now (with Python 3) but it gives above error although I followed recommendations on this link No trigger by the name "interval" was found.