Esempio n. 1
0
@author: Sam Gegg
'''
from connect.Monnect import ConnectM

from KoofersWebScraper.KoofersWebScraper import get_course_list
from RateMyProfessorWebScraper.WebScraper import get_prof_list

'''
Script gets all subjects in a given term of a given year.
'''
HOST = 'digitalocean-4.perryhuang.com'
PORT = 27017

client_courses = ConnectM(HOST, PORT)
client_courses.connect()
client_courses.set_database_name('courses')
client_courses.set_collection('courses_general')

print('Adding Koofers course data')

course_list = get_course_list()
for course in course_list:
    print(course)
    client_courses.update({"course_id": course.course_number, "code": course.subject_code}, course.dataToUpdateDoc())
  
client_courses.disconnect()

print('Finished adding course data')

client_profs = ConnectM(HOST, PORT)
client_profs.connect()
Esempio n. 2
0
            collection2.remove(remove_query)
            print(collection2.find(crn_check).count())
            collection2.update(crn_check, check, upsert=True)
            print(collection2.find(crn_check).count())
            print('Done deleting')
    cursor2.close()

'''
Script gets all subjects in a given term of a given year.
'''
HOST = 'digitalocean-4.perryhuang.com'
PORT = 27017

client_courses = ConnectM(HOST, PORT)
client_courses.connect()
client_courses.set_database_name('courses')
#client_courses.set_collection('courses_general')

#collection = client_courses.client[client_courses.db_name][client_courses.collection_name]
#cursor = collection.find({},timeout=False)

#delete_extra_courses(collection, cursor)

#collection2 = client_courses.client[client_courses.db_name]['courses_section']
#cursor2 = collection2.find({}, timeout=False)

#print(cursor2.count())
#add_time_nums(collection2)

#print('done part 1')