Ejemplo n.º 1
0
    def setSchoolDetails(self):

       for schoolID in self.schoolIDs:

            url = "http://www.education.gov.uk/schools/performance/school/{}".format(schoolID)

            content = getPage(url)
            soup = BeautifulSoup(content)

            queries = ["Head","Street","Town","Postcode","Telephone number"]

            try:
                name = getName(soup)
                attrObject = getItems(soup,queries)
                date,grade,link = getOfsted(soup)
            except PageError:
                continue

            school = SchoolObject(schoolID)
            school.url = url
            school.setName(name)
            school.setAttr(attrObject)
            school.setOfsted(date,grade,link)

            self.schools.append(school)
Ejemplo n.º 2
0
    def addSchool(self,schoolObject):

        try:
            ofstedOverall = schoolObject["ofstedGrade"].split("-")
            schoolObject["ofstedGrade"] = int(ofstedOverall[0].strip())
        except ValueError:
            schoolObject["ofstedGrade"] = 0

        school = SchoolObject()
        school.setAttr(schoolObject)
        self.schools.append(school)

        filename = "{}.json".format(schoolObject["URN"])
        folder = "schools"
        saveJSON(filename,schoolObject,folder)
Ejemplo n.º 3
0
    def getOfstead(self):
        
        url = self.school.report
        content = getPage(url)
        soup = BeautifulSoup(content)
        div = soup.find(class_="download-report-link")

        if not div:
            print("Error for school {}".format(self.school))
            return

        link = div.find("a")
        urlPath = link["href"]
        urlBase = "http://reports.ofsted.gov.uk"

        url = urlBase + urlPath
        report = getPDF(url)
        savePDF(self.filename(),report)

if (__name__ == "__main__"):
    filenames = glob.glob("schools/*.json")

    for filename in filenames:

        schoolObject = SchoolObject()
        schoolObject.load(filename)

        ofsteadSearch = OfsteadSearch()
        ofsteadSearch.setSchool(schoolObject)
        ofsteadSearch.getOfstead()
Ejemplo n.º 4
0
    def getOfstead(self):

        url = self.school.report
        content = getPage(url)
        soup = BeautifulSoup(content)
        div = soup.find(class_="download-report-link")

        if not div:
            print("Error for school {}".format(self.school))
            return

        link = div.find("a")
        urlPath = link["href"]
        urlBase = "http://reports.ofsted.gov.uk"

        url = urlBase + urlPath
        report = getPDF(url)
        savePDF(self.filename(), report)


if (__name__ == "__main__"):
    filenames = glob.glob("schools/*.json")

    for filename in filenames:

        schoolObject = SchoolObject()
        schoolObject.load(filename)

        ofsteadSearch = OfsteadSearch()
        ofsteadSearch.setSchool(schoolObject)
        ofsteadSearch.getOfstead()