forked from cobalt-uoft/uoft-scrapers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (34 loc) · 917 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from collections import OrderedDict
import time
import os
import re
import json
import pymongo
import pprint
from course.course import CourseManager
from building.building import BuildingManager
from food.food import FoodManager
class Scraper:
def __init__(self):
with open('config.json') as data_file:
self.config = json.load(data_file)
self.db = pymongo.MongoClient(self.config["MONGO_URL"])
def run(self):
self.refresh_courses()
self.refresh_buildings()
self.refresh_foods()
def refresh_courses(self):
c = CourseManager(self.db)
c.update()
c.upload()
def refresh_buildings(self):
b = BuildingManager(self.db)
b.update()
b.upload()
def refresh_foods(self):
f = FoodManager(self.db)
f.update()
f.upload()
if __name__ == "__main__":
s = Scraper()
s.run()