rmp.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:ScheduleStorm_Server 作者: Step7750 项目源码 文件源码
def __init__(self, rmpids, interval):
        """
        Constructor for RateMyProfessors to set the RMP schools to request and the interval

        :param rmpids: **list** List of rmp ids to scrape for
        :param interval: **int** Seconds to wait in between scraping
        :return:
        """
        threading.Thread.__init__(self)
        # Pass in a list that contains the the ids to fetch
        self.ids = rmpids

        # The amount of seconds to wait before scraping RMP again
        self.interval = interval

        # Establish db connection
        self.db = pymongo.MongoClient().ScheduleStorm

        log.info("Ensuring MongoDB indexes exist")
        self.db.RateMyProfessors.create_index(
            [("school", pymongo.ASCENDING)]
        )

        self.db.RateMyProfessors.create_index(
            [("id", pymongo.ASCENDING),
             ("school", pymongo.ASCENDING)],
            unique=True
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号