From 52ecac223380517bc1d2257e84d9a3a571b4a4e0 Mon Sep 17 00:00:00 2001 From: "duncan.parkes" Date: Sun, 7 Jun 2009 13:45:38 +0000 Subject: [PATCH] Add info url for Elmbridge. --- SitesToGenerate.csv | 2 +- python_scrapers/Planet.py | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/SitesToGenerate.csv b/SitesToGenerate.csv index c85d6a7..a280bbf 100644 --- a/SitesToGenerate.csv +++ b/SitesToGenerate.csv @@ -102,7 +102,7 @@ "Eden District Council","Eden",,,,,,"http://eforms.eden.gov.uk/fastweb/","FastWeb","FastWeb", "The City of Edinburgh Council","Edinburgh",,,,,,"http://citydev-portal.edinburgh.gov.uk/publicaccess/tdc/","PublicAccess","PublicAccessParser", "Ellesmere Port and Neston Borough Council","Ellesmere Port",,,,,,"http://ocella.epnbc.gov.uk/portal/page?_pageid=33,38205&_dad=portal&_schema=PORTAL","Ocella","OcellaParser", -"Elmbridge Borough Council","Elmbridge",,,,,,"http://www2.elmbridge.gov.uk/Planet/ispforms.asp?serviceKey=SysDoc-PlanetApplicationEnquiry","Planet","PlanetParser", +"Elmbridge Borough Council","Elmbridge",,,,,,"http://www2.elmbridge.gov.uk/Planet/ispforms.asp?serviceKey=SysDoc-PlanetApplicationEnquiry","Planet","ElmbridgeParser", "London Borough of Enfield","Enfield",,,,,,"http://forms.enfield.gov.uk/swiftlg/apas/run/wphappcriteria.display","SwiftLG","SwiftLGParser", "Epping Forest District Council","Epping Forest",,"http://duncan.devel.disruptiveproactivity.com/Epping%20Forest.cgi?day={day}&month={month}&year={year}",1,,,"http://plan1.eppingforestdc.gov.uk/","PlanningExplorer","EppingForestParser", "Epsom and Ewell Borough Council","Epsom and Ewell",,,,,,"http://eplanning.epsom-ewell.gov.uk/publicaccess/tdc/","PublicAccess","PublicAccessParser", diff --git a/python_scrapers/Planet.py b/python_scrapers/Planet.py index 63f0bad..de9db8f 100644 --- a/python_scrapers/Planet.py +++ b/python_scrapers/Planet.py @@ -33,6 +33,12 @@ class PlanetParser: self._results = PlanningAuthorityResults(self.authority_name, self.authority_short_name) + def get_info_url(self, soup_fragment): + return self.base_url + + def get_comment_url(self, soup_fragment): + return self.get_info_url(soup_fragment) + def getResultsByDayMonthYear(self, day, month, year): # What is the serviceKey for this council? # It's in our base url @@ -101,10 +107,10 @@ class PlanetParser: self._current_application.description = tds[2].string.strip() # There is no good info url, so we just give the search page. - self._current_application.info_url = self.base_url + self._current_application.info_url = self.get_info_url(tr) # Similarly for the comment url - self._current_application.comment_url = self.base_url + self._current_application.comment_url = self.get_comment_url(tr) self._results.addApplication(self._current_application) @@ -146,13 +152,20 @@ class PlanetParser: return self.getResultsByDayMonthYear(int(day), int(month), int(year)).displayXML() +class ElmbridgeParser(PlanetParser): + info_url_template = "http://emaps.elmbridge.gov.uk/LinkToSoftwareAG.aspx?appref=%s" + + def get_info_url(self, soup_fragment): + return self.info_url_template %self._current_application.council_reference + + if __name__ == '__main__': -# parser = PlanetParser("Elmbridge Borough Council", "Elmbridge", "http://www2.elmbridge.gov.uk/Planet/ispforms.asp?serviceKey=SysDoc-PlanetApplicationEnquiry") + parser = ElmbridgeParser("Elmbridge Borough Council", "Elmbridge", "http://www2.elmbridge.gov.uk/Planet/ispforms.asp?serviceKey=SysDoc-PlanetApplicationEnquiry") # parser = PlanetParser("North Lincolnshire Council", "North Lincolnshire", "http://www.planning.northlincs.gov.uk/planet/ispforms.asp?ServiceKey=SysDoc-PlanetApplicationEnquiry") # parser = PlanetParser("Rydale District Council", "Rydale", "http://www.ryedale.gov.uk/ispforms.asp?serviceKey=SysDoc-PlanetApplicationEnquiry") - parser = PlanetParser("Tewkesbury Borough Council", "Tewkesbury", "http://planning.tewkesbury.gov.uk/Planet/ispforms.asp?serviceKey=07WCC04163103430") - print parser.getResults(20,11,2008) +# parser = PlanetParser("Tewkesbury Borough Council", "Tewkesbury", "http://planning.tewkesbury.gov.uk/Planet/ispforms.asp?serviceKey=07WCC04163103430") # parser = PlanetParser("Worcester City Council", "Worcester", "http://www.worcester.gov.uk:8080/planet/ispforms.asp?serviceKey=SysDoc-PlanetApplicationEnquiry", debug=True) + print parser.getResults(1,5,2009) # TODO