2024-09-03 16:37:39 -06:00
|
|
|
import logging
|
|
|
|
import pickle
|
|
|
|
import time
|
|
|
|
|
|
|
|
from redis import Redis
|
|
|
|
|
2024-11-06 12:48:45 -07:00
|
|
|
from lib.glotec import get_latest_glotec
|
2024-09-03 16:37:39 -06:00
|
|
|
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
|
|
|
|
|
2024-09-03 17:09:36 -06:00
|
|
|
def main():
|
|
|
|
redis = Redis(host='localhost', port=6379, db=0)
|
|
|
|
redis.flushall()
|
|
|
|
while True:
|
2024-11-06 12:48:45 -07:00
|
|
|
logging.info('Fetching latest GLOTEC data')
|
|
|
|
geojson = get_latest_glotec()
|
|
|
|
redis.set('latest_glotec_data', pickle.dumps(geojson))
|
2024-09-03 17:09:36 -06:00
|
|
|
logging.info('Scrape complete')
|
|
|
|
time.sleep(1800) # 30 minutes
|
2024-09-03 16:37:39 -06:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2024-09-03 17:09:36 -06:00
|
|
|
main()
|