Browse Source

remove generated cgi files

master
duncan.parkes 17 years ago
parent
commit
f9d97ae51a
100 changed files with 0 additions and 4889 deletions
  1. +0
    -504
      cgi-bin/AcolnetParser.py
  2. +0
    -33
      cgi-bin/Allerdale.cgi
  3. +0
    -33
      cgi-bin/Alnwick.cgi
  4. +0
    -33
      cgi-bin/Angus.cgi
  5. +0
    -518
      cgi-bin/ApplicationSearchServletParser.py
  6. +0
    -33
      cgi-bin/Aylesbury Vale.cgi
  7. +0
    -33
      cgi-bin/Babergh.cgi
  8. +0
    -33
      cgi-bin/Barrow.cgi
  9. +0
    -33
      cgi-bin/Basildon.cgi
  10. +0
    -33
      cgi-bin/Basingstoke and Deane.cgi
  11. +0
    -33
      cgi-bin/Bassetlaw.cgi
  12. +0
    -33
      cgi-bin/Bath.cgi
  13. +0
    -33
      cgi-bin/Bexley.cgi
  14. +0
    -33
      cgi-bin/Blaby.cgi
  15. +0
    -33
      cgi-bin/Bolsover.cgi
  16. +0
    -33
      cgi-bin/Bracknell Forest.cgi
  17. +0
    -33
      cgi-bin/Bridgnorth.cgi
  18. +0
    -33
      cgi-bin/Bristol.cgi
  19. +0
    -33
      cgi-bin/Broads.cgi
  20. +0
    -33
      cgi-bin/Bromley.cgi
  21. +0
    -33
      cgi-bin/Buckinghamshire.cgi
  22. +0
    -33
      cgi-bin/Bury.cgi
  23. +0
    -33
      cgi-bin/Caradon.cgi
  24. +0
    -33
      cgi-bin/Carlisle.cgi
  25. +0
    -33
      cgi-bin/Chelmsford.cgi
  26. +0
    -33
      cgi-bin/Cherwell.cgi
  27. +0
    -33
      cgi-bin/Chiltern.cgi
  28. +0
    -33
      cgi-bin/Chorley.cgi
  29. +0
    -33
      cgi-bin/City of London.cgi
  30. +0
    -33
      cgi-bin/Cornwall.cgi
  31. +0
    -33
      cgi-bin/Coventry.cgi
  32. +0
    -33
      cgi-bin/Craven.cgi
  33. +0
    -33
      cgi-bin/Croydon.cgi
  34. +0
    -33
      cgi-bin/Denbighshire.cgi
  35. +0
    -33
      cgi-bin/Derby.cgi
  36. +0
    -33
      cgi-bin/Doncaster.cgi
  37. +0
    -33
      cgi-bin/Dundee.cgi
  38. +0
    -33
      cgi-bin/Durham.cgi
  39. +0
    -33
      cgi-bin/Ealing.cgi
  40. +0
    -33
      cgi-bin/Easington.cgi
  41. +0
    -33
      cgi-bin/East Devon.cgi
  42. +0
    -33
      cgi-bin/East Dorset.cgi
  43. +0
    -33
      cgi-bin/East Lindsey.cgi
  44. +0
    -33
      cgi-bin/Eastleigh.cgi
  45. +0
    -33
      cgi-bin/Eden.cgi
  46. +0
    -33
      cgi-bin/Edinburgh.cgi
  47. +0
    -33
      cgi-bin/Epsom and Ewell.cgi
  48. +0
    -207
      cgi-bin/FastWeb.py
  49. +0
    -33
      cgi-bin/Fenland.cgi
  50. +0
    -33
      cgi-bin/Fylde.cgi
  51. +0
    -33
      cgi-bin/Gateshead.cgi
  52. +0
    -33
      cgi-bin/Gedling.cgi
  53. +0
    -33
      cgi-bin/Gloucestershire.cgi
  54. +0
    -33
      cgi-bin/Gravesham.cgi
  55. +0
    -33
      cgi-bin/Hambleton.cgi
  56. +0
    -33
      cgi-bin/Hammersmith and Fulham.cgi
  57. +0
    -33
      cgi-bin/Haringey.cgi
  58. +0
    -33
      cgi-bin/Harlow.cgi
  59. +0
    -33
      cgi-bin/Harrogate.cgi
  60. +0
    -33
      cgi-bin/Hart.cgi
  61. +0
    -33
      cgi-bin/Hartlepool.cgi
  62. +0
    -33
      cgi-bin/Hertsmere.cgi
  63. +0
    -33
      cgi-bin/High Peak.cgi
  64. +0
    -33
      cgi-bin/Hinkley and Bosworth.cgi
  65. +0
    -33
      cgi-bin/Huntingdonshire.cgi
  66. +0
    -33
      cgi-bin/Kerrier.cgi
  67. +0
    -33
      cgi-bin/Knowsley.cgi
  68. +0
    -33
      cgi-bin/Lancaster.cgi
  69. +0
    -33
      cgi-bin/Lewisham.cgi
  70. +0
    -33
      cgi-bin/Luton.cgi
  71. +0
    -33
      cgi-bin/Malvern Hills.cgi
  72. +0
    -33
      cgi-bin/Manchester.cgi
  73. +0
    -33
      cgi-bin/Mansfield.cgi
  74. +0
    -33
      cgi-bin/Mid Devon.cgi
  75. +0
    -33
      cgi-bin/Milton Keynes.cgi
  76. +0
    -33
      cgi-bin/Moray.cgi
  77. +0
    -133
      cgi-bin/MultipartPostHandler.py
  78. +0
    -33
      cgi-bin/NW Leicestershire.cgi
  79. +0
    -33
      cgi-bin/New Forest DC.cgi
  80. +0
    -33
      cgi-bin/New Forest NP.cgi
  81. +0
    -33
      cgi-bin/Newcastle-under-Lyme.cgi
  82. +0
    -33
      cgi-bin/Newcastle.cgi
  83. +0
    -33
      cgi-bin/Newham.cgi
  84. +0
    -33
      cgi-bin/North Hertfordshire.cgi
  85. +0
    -33
      cgi-bin/North Tyneside.cgi
  86. +0
    -33
      cgi-bin/North Warwickshire.cgi
  87. +0
    -33
      cgi-bin/North Wiltshire.cgi
  88. +0
    -33
      cgi-bin/Northumberland.cgi
  89. +0
    -33
      cgi-bin/Oadby and Wigston.cgi
  90. +0
    -33
      cgi-bin/Oldham.cgi
  91. +0
    -33
      cgi-bin/Oswestry.cgi
  92. +0
    -33
      cgi-bin/Perthshire.cgi
  93. +0
    -33
      cgi-bin/Peterborough.cgi
  94. +0
    -102
      cgi-bin/PlanningUtils.py
  95. +0
    -33
      cgi-bin/Portsmouth.cgi
  96. +0
    -351
      cgi-bin/PublicAccess.py
  97. +0
    -5
      cgi-bin/README
  98. +0
    -33
      cgi-bin/Redditch.cgi
  99. +0
    -33
      cgi-bin/Renfrewshire.cgi
  100. +0
    -33
      cgi-bin/Rushmoor.cgi

+ 0
- 504
cgi-bin/AcolnetParser.py View File

@@ -1,504 +0,0 @@
#!/usr/local/bin/python

import urllib, urllib2
import HTMLParser
#from BeautifulSoup import BeautifulSoup

# Adding this to try to help Surrey Heath - Duncan 14/9/2007
import cookielib
cookie_jar = cookielib.CookieJar()
################

import urlparse

import re

end_head_regex = re.compile("</head", re.IGNORECASE)

import MultipartPostHandler
# this is not mine, or part of standard python (though it should be!)
# it comes from http://pipe.scs.fsu.edu/PostHandler/MultipartPostHandler.py

from PlanningUtils import getPostcodeFromText, PlanningAuthorityResults, PlanningApplication

from datetime import date
from time import strptime


date_format = "%d/%m/%Y"
our_date = date(2007,4,25)

#This is to get the system key out of the info url
system_key_regex = re.compile("TheSystemkey=(\d*)", re.IGNORECASE)

class AcolnetParser(HTMLParser.HTMLParser):
case_number_tr = None # this one can be got by the td class attribute
reg_date_tr = None
location_tr = None
proposal_tr = None

# There is no online comment facility in these, so we provide an
# appropriate email address instead
comments_email_address = None

action_regex = re.compile("<form[^>]*action=\"([^\"]*ACTION=UNWRAP&RIPSESSION=[^\"]*)\"[^>]*>", re.IGNORECASE)
def __init__(self,
authority_name,
authority_short_name,
base_url,
debug=False):


HTMLParser.HTMLParser.__init__(self)

self.authority_name = authority_name
self.authority_short_name = authority_short_name
self.base_url = base_url

self.debug = debug

self._tr_number = 0

# This will be used to track the subtable depth
# when we are in a results-table, in order to
# avoid adding an application before we have got to
# the end of the results-table
self._subtable_depth = None

self._in_td = False

# This in where we store the results
self._results = PlanningAuthorityResults(self.authority_name, self.authority_short_name)

# This will store the planning application we are currently working on.
self._current_application = None


def _cleanupHTML(self, html):
"""This method should be overridden in subclasses to perform site specific
HTML cleanup."""
return html

def handle_starttag(self, tag, attrs):
#print tag, attrs
if tag == "table":
if self._current_application is None:
# Each application is in a separate table with class "results-table"
for key, value in attrs:
if key == "class" and value == "results-table":
#print "found results-table"
self._current_application = PlanningApplication()
self._tr_number = 0
self._subtable_depth = 0
self._current_application.comment_url = self.comments_email_address
break
else:
# We are already in a results-table, and this is the start of a subtable,
# so increment the subtable depth.
self._subtable_depth += 1

elif self._current_application is not None:
if tag == "tr" and self._subtable_depth == 0:
self._tr_number += 1
if tag == "td":
self._in_td = True
if tag == "a" and self._tr_number == self.case_number_tr:
# this is where we get the info link and the case number
for key, value in attrs:
if key == "href":
self._current_application.info_url = value

system_key = system_key_regex.search(value).groups()[0]

if self.comments_email_address is not None:
self._current_application.comment_url = self.comments_email_address
else:
self._current_application.comment_url = value.replace("PgeResultDetail", "PgeCommentForm")
def handle_data(self, data):
# If we are in the tr which contains the case number,
# then data is the council reference, so
# add it to self._current_application.
if self._in_td:
if self._tr_number == self.case_number_tr:
self._current_application.council_reference = data.strip()
elif self._tr_number == self.reg_date_tr:
# we need to make a date object out of data
date_as_str = ''.join(data.strip().split())
received_date = date(*strptime(date_as_str, date_format)[0:3])

#print received_date

self._current_application.date_received = received_date

elif self._tr_number == self.location_tr:
location = data.strip()

self._current_application.address = location
self._current_application.postcode = getPostcodeFromText(location)
elif self._tr_number == self.proposal_tr:
self._current_application.description = data.strip()


def handle_endtag(self, tag):
#print "ending: ", tag
if tag == "table" and self._current_application is not None:
if self._subtable_depth > 0:
self._subtable_depth -= 1
else:
# We need to add the last application in the table
if self._current_application is not None:
#print "adding application"
self._results.addApplication(self._current_application)
#print self._current_application
self._current_application = None
self._tr_number = None
self._subtable_depth = None
elif tag == "td":
self._in_td = False


def _getSearchResponse(self):
# It looks like we sometimes need to do some stuff to get around a
# javascript redirect and cookies.
search_form_request = urllib2.Request(self.base_url)
search_form_response = urllib2.urlopen(search_form_request)

return search_form_response

def getResultsByDayMonthYear(self, day, month, year):
# first we fetch the search page to get ourselves some session info...
search_form_response = self._getSearchResponse()
search_form_contents = search_form_response.read()

#outfile = open("tmpfile", "w")
#outfile.write(search_form_contents)

# This sometimes causes a problem in HTMLParser, so let's just get the link
# out with a regex...

groups = self.action_regex.search(search_form_contents).groups()

action = groups[0]
#print action

action_url = urlparse.urljoin(self.base_url, action)
#print action_url

our_date = date(year, month, day)
search_data = {"regdate1": our_date.strftime(date_format),
"regdate2": our_date.strftime(date_format),
}
opener = urllib2.build_opener(MultipartPostHandler.MultipartPostHandler)
response = opener.open(action_url, search_data)
results_html = response.read()

# This is for doing site specific html cleanup
results_html = self._cleanupHTML(results_html)

#some javascript garbage in the header upsets HTMLParser,
#so we'll just have the body
just_body = "<html>" + end_head_regex.split(results_html)[-1]

#outfile = open(self.authority_short_name + ".debug", "w")
#outfile.write(just_body)

self.feed(just_body)
return self._results



def getResults(self, day, month, year):
return self.getResultsByDayMonthYear(int(day), int(month), int(year)).displayXML()


class BaberghParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

# It would be nice to scrape this...
comments_email_address = "planning.reception@babergh.gov.uk"

class BasingstokeParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 6
proposal_tr = 8

# It would be nice to scrape this...
comments_email_address = "development.control@basingstoke.gov.uk"

class BassetlawParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 5
proposal_tr = 6

comments_email_address = "planning@bassetlaw.gov.uk"

def _cleanupHTML(self, html):
"""There is a broken div in this page. We don't need any divs, so
let's get rid of them all."""

div_regex = re.compile("</?div[^>]*>", re.IGNORECASE)
return div_regex.sub('', html)


class BridgnorthParser(AcolnetParser):
# This site is currently down...
#search_url = "http://www2.bridgnorth-dc.gov.uk/planning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.PgeSearch"
#authority_name = "Bridgenorth District Council"
#authority_short_name = "Bridgenorth"

case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "contactus@bridgnorth-dc.gov.uk"

class BuryParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "development.control@bury.gov.uk"

## class CanterburyParser(AcolnetParser):
## search_url = "http://planning.canterbury.gov.uk/scripts/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

## case_number_tr = 1 # this one can be got by the td class attribute
## reg_date_tr = 2
## location_tr = 4
## proposal_tr = 5

## authority_name = "Canterbury City Council"
## authority_short_name = "Canterbury"

## comments_email_address = ""

class CarlisleParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 5
proposal_tr = 6

comments_email_address = "dc@carlisle.gov.uk"

class DerbyParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 4
proposal_tr = 5

comments_email_address = "developmentcontrol@derby.gov.uk"

class CroydonParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 5
proposal_tr = 6

comments_email_address = "planning.control@croydon.gov.uk"

class EastLindseyParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 5
proposal_tr = 6

comments_email_address = "development.control@e-lindsey.gov.uk"

class FyldeParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "planning@fylde.gov.uk"

class HarlowParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "Planning.services@harlow.gov.uk"

class HavantParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 6
proposal_tr = 8

comments_email_address = "representations@havant.gov.uk"

class HertsmereParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "planning@hertsmere.gov.uk"

class LewishamParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "planning@lewisham.gov.uk"
class NorthHertfordshireParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

## class MidSuffolkParser(AcolnetParser):
## case_number_tr = 1 # this one can be got by the td class attribute
## reg_date_tr = 2
## location_tr = 4
## proposal_tr = 5

## comments_email_address = "planning@lewisham.gov.uk"
## #action_regex = re.compile("<FORM .*action=\"(.*ACTION=UNWRAP&RIPSESSION=[^\"]*)\"[^>]*>", re.IGNORECASE)

class NewForestNPParser(AcolnetParser):
# In this case there is an online comment facility at the
# bottom of each view app page...
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

class NewForestDCParser(AcolnetParser):
# In this case there is an online comment facility at the
# bottom of each view app page...
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 5
proposal_tr = 6

class NorthWiltshireParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 6
proposal_tr = 7

class OldhamParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 6
proposal_tr = 7
def _cleanupHTML(self, html):
"""There is a bad table end tag in this one.
Fix it before we start"""
bad_table_end = '</table summary="Copyright">'
good_table_end = '</table>'
return html.replace(bad_table_end, good_table_end)

class RenfrewshireParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "pt@renfrewshire.gov.uk"

class SouthBedfordshireParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 3
location_tr = 5
proposal_tr = 6

class SuffolkCoastalParser(AcolnetParser):
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "d.c.admin@suffolkcoastal.gov.uk"

class GuildfordParser(AcolnetParser):
case_number_tr = 1
reg_date_tr = 7
location_tr = 2
proposal_tr = 3
#http://www.guildford.gov.uk/acolnet/acolnetcgi.gov?ACTION=UNWRAP&Root=PgeSearch

class SurreyHeathParser(AcolnetParser):
# This is not working yet.
# _getSearchResponse is an attempt to work around
# cookies and a javascript redirect.
# I may have a bit more of a go at this at some point if I have time.
case_number_tr = 1 # this one can be got by the td class attribute
reg_date_tr = 2
location_tr = 4
proposal_tr = 5

comments_email_address = "development-control@surreyheath.gov.uk"

def _getSearchResponse(self):
# It looks like we sometimes need to do some stuff to get around a
# javascript redirect and cookies.
search_form_request = urllib2.Request(self.base_url)

# Lying about the user-agent doesn't seem to help.
#search_form_request.add_header("user-agent", "Mozilla/5.0 (compatible; Konqu...L/3.5.6 (like Gecko) (Kubuntu)")
search_form_response = urllib2.urlopen(search_form_request)
cookie_jar.extract_cookies(search_form_response, search_form_request)


print search_form_response.geturl()
print search_form_response.info()

print search_form_response.read()
# validate_url = "https://www.public.surreyheath-online.gov.uk/whalecom7cace3215643e22bb7b0b8cc97a7/whalecom0/InternalSite/Validate.asp"
# javascript_redirect_url = urlparse.urljoin(self.base_url, "/whalecom7cace3215643e22bb7b0b8cc97a7/whalecom0/InternalSite/RedirectToOrigURL.asp?site_name=public&secure=1")

# javascript_redirect_request = urllib2.Request(javascript_redirect_url)
# javascript_redirect_request.add_header('Referer', validate_url)
# cookie_jar.add_cookie_header(javascript_redirect_request)

# javascript_redirect_response = urllib2.urlopen(javascript_redirect_request)
# return javascript_redirect_response
if __name__ == '__main__':
day = 22
month = 2
year = 2005

# returns error 400 - bad request
#parser = BridgenorthParser()

# cambridgeshire is a bit different...
# no advanced search page

# canterbury
# results as columns of one table

#parser = SurreyHeathParser("Surrey Heath", "Surrey Heath", "https://www.public.surreyheath-online.gov.uk/whalecom60b1ef305f59f921/whalecom0/Scripts/PlanningPagesOnline/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch")

parser = GuildfordParser("Guildford", "Guildford", "http://www.guildford.gov.uk/acolnet/acolnetcgi.gov?ACTION=UNWRAP&Root=PgeSearch")
print parser.getResults(day, month, year)

+ 0
- 33
cgi-bin/Allerdale.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Allerdale Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Allerdale Borough Council"
authority_short_name = "Allerdale"
base_url = "http://planning.allerdale.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.AllerdaleSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Alnwick.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Alnwick District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Alnwick District Council"
authority_short_name = "Alnwick"
base_url = "http://services.castlemorpeth.gov.uk:7777/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.AlnwickSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Angus.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Angus Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Angus Council"
authority_short_name = "Angus"
base_url = "http://planning.angus.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 518
cgi-bin/ApplicationSearchServletParser.py View File

@@ -1,518 +0,0 @@

import urllib, urllib2

import HTMLParser
import urlparse
import datetime, time


from PlanningUtils import PlanningAuthorityResults, \
getPostcodeFromText, \
PlanningApplication


# The search results list will give us reference, location, description,
# and info url of each app.

# The info page gives us the received date,
# and comment_url

class ApplicationSearchServletParser(HTMLParser.HTMLParser):
"""Parser for ApplicationSearchServlet sites.
"""


# These indicate the column of the main table containing this
# piece of information.
# They should be overridden in subclasses

#self._rows_to_ignore_at_start = None

_reference_col_no = None
_location_col_no = None
_description_col_no = None
def __init__(self,
authority_name,
authority_short_name,
base_url,
debug=False):
HTMLParser.HTMLParser.__init__(self)

self.authority_name = authority_name
self.authority_short_name = authority_short_name
self.base_url = base_url
self.debug = debug

self.search_url = urlparse.urljoin(self.base_url, "portal/servlets/ApplicationSearchServlet")

self._comment_url = urlparse.urljoin(self.base_url, "portal/servlets/PlanningComments?REFNO=%(council_reference)s")

self._requested_date = None

# 0 - no
# 1 - maybe
# 2 - yes
# 3 - finished
self._in_results_table = 0
self._tr_count = 0
self._td_count = 0
self._data_list = []

# this will hold the application we are currently working on.
self._current_application = None
# The object which stores our set of planning application results
self._results = PlanningAuthorityResults(self.authority_name, self.authority_short_name)

def _checkAttrsForResultsTable(self, attrs):
raise SystemError

def handle_starttag(self, tag, attrs):
if self.debug:
print tag, attrs
if tag == "table" and self._in_results_table == 0:
self._in_results_table = 1
self._checkAttrsForResultsTable(attrs)
elif tag == "tr" and self._in_results_table == 2:
self._tr_count += 1
self._td_count = 0
self._data_list = []
self._current_application = PlanningApplication()
elif tag == "td" and self._in_results_table == 2:
self._td_count += 1

elif tag == "a" and self._in_results_table == 2 and self._td_count == self._reference_col_no:
# The href attribute contains the link to the info page
for (key, value) in attrs:
if key == "href":
self._current_application.info_url = urlparse.urljoin(self.search_url, value)
def handle_endtag(self, tag):
if self.debug:
print "ending: " , tag
if tag == "table" and self._in_results_table == 2:
self._in_results_table = 3
elif tag == "tr" and self._in_results_table == 2:
if self._current_application.council_reference is not None:
# get the received date
#info_response = urllib2.urlopen(self._current_application.info_url)
#info_page_parser = InfoPageParser()
#info_page_parser.feed(info_response.read())
self._current_application.date_received = self._requested_date#info_page_parser.date_received
self._results.addApplication(self._current_application)
elif tag == "td" and self._in_results_table == 2:
if self._td_count == self._location_col_no:
data = ' '.join(self._data_list).strip()
self._current_application.address = data
postcode = getPostcodeFromText(data)
if postcode is not None:
self._current_application.postcode = postcode
self._data_list = []
elif self._td_count == self._description_col_no:
data = ' '.join(self._data_list).strip()
self._current_application.description = data
self._data_list = []
elif tag == 'a' and self._in_results_table == 2 and self._td_count == self._reference_col_no:
data = ''.join(self._data_list).strip()
self._current_application.council_reference = data
self._current_application.comment_url = self._comment_url %{"council_reference": data}
self._data_list = []

def handle_data(self, data):
if self.debug:
print data
if self._in_results_table == 2:
if self._td_count == self._reference_col_no or \
self._td_count == self._location_col_no or \
self._td_count == self._description_col_no:
self._data_list.append(data.strip())


def getResultsByDayMonthYear(self, day, month, year):
"""This will return an ApplicationResults object containg the
applications for the date passed in."""

# Were going to need a datetime object for the requested date
self._requested_date = datetime.date(year, month, day)

required_format = "%d-%m-%Y"

search_data = urllib.urlencode({"ReceivedDateFrom":self._requested_date.strftime(required_format),
"ReceivedDateTo":self._requested_date.strftime(required_format)})
search_request = urllib2.Request(self.search_url, search_data)
search_response = urllib2.urlopen(search_request)
search_contents = search_response.read()

self.feed(search_contents)

return self._results
def getResults(self, day, month, year):
return self.getResultsByDayMonthYear(int(day), int(month), int(year)).displayXML()


class CoventrySearchParser(ApplicationSearchServletParser):
# results table spotter
# width="100%" border="0"

_reference_col_no = 1
_location_col_no = 5
_description_col_no = 8
def _checkAttrsForResultsTable(self, attrs):
got_width = False
got_border = False
for key, value in attrs:
if key == 'width' and value == '100%':
got_width = True
elif key == 'border' and value == '0':
got_border = True

if got_width and got_border:
self._in_results_table = 2
else:
self._in_results_table = 0



class AllerdaleSearchParser(ApplicationSearchServletParser):
# results table spotter
#class="nis_table" summary="Table of planning applications that matched your query, showing reference number, received date, and address"

_reference_col_no = 1
_location_col_no = 3
_description_col_no = 6
def _checkAttrsForResultsTable(self, attrs):
got_class = False
got_summary = False
for key, value in attrs:
if key == 'class' and value == 'nis_table':
got_class = True
elif key == 'summary' and value == 'Table of planning applications that matched your query, showing reference number, received date, and address':
got_summary = True

if got_class and got_summary:
self._in_results_table = 2
else:
self._in_results_table = 0



class AlnwickSearchParser(ApplicationSearchServletParser):
# results table spotter
# width="100%" class="niscontent"
_reference_col_no = 1
_location_col_no = 2
_description_col_no = 7
def _checkAttrsForResultsTable(self, attrs):
got_class = False
for key, value in attrs:
if key == 'class' and value == 'niscontent':
got_class = True

if got_class:
self._in_results_table = 2
else:
self._in_results_table = 0


class BarrowSearchParser(ApplicationSearchServletParser):
# results table spotter
# width="100%" border="0"
_reference_col_no = 1
_location_col_no = 3
_description_col_no = 6
def _checkAttrsForResultsTable(self, attrs):
got_width = False
got_border = False
for key, value in attrs:
if key == 'width' and value == '100%':
got_width = True
elif key == 'border' and value == '0':
got_border = True

if got_width and got_border:
self._in_results_table = 2
else:
self._in_results_table = 0


class HartlepoolSearchParser(ApplicationSearchServletParser):
# results table spotter
# summary="Table of planning applications that matched your query, showing reference number, received date, and address"
_reference_col_no = 1
_location_col_no = 2
_description_col_no = 3
def _checkAttrsForResultsTable(self, attrs):
got_summary = False
for key, value in attrs:
if key == 'summary' and value == "Table of planning applications that matched your query, showing reference number, received date, and address":
got_summary = True

if got_summary:
self._in_results_table = 2
else:
self._in_results_table = 0


class NorthWarksSearchParser(ApplicationSearchServletParser):
# results table spotter
# table width="100%" border="0" cellspacing="0" cellpadding="0"
_reference_col_no = 1
_location_col_no = 3
_description_col_no = 4
def _checkAttrsForResultsTable(self, attrs):
got_width = False
got_border = False
got_cellspacing = False
got_cellpadding = False
for key, value in attrs:
if key == 'width' and value == "100%":
got_width = True
elif key == 'border' and value == '0':
got_border = True
elif key == 'cellspacing' and value == '0':
got_cellspacing = True
elif key == 'cellpadding' and value == '0':
got_cellpadding = True

if got_width and got_border and got_cellspacing and got_cellpadding:
self._in_results_table = 2
else:
self._in_results_table = 0

class StHelensSearchParser(ApplicationSearchServletParser):
# results table spotter
# summary="Search Results List"
_reference_col_no = 1
_location_col_no = 2
_description_col_no = 5
def _checkAttrsForResultsTable(self, attrs):
got_summary = False
for key, value in attrs:
if key == 'summary' and value == "Search Results List":
got_summary = True

if got_summary:
self._in_results_table = 2
else:
self._in_results_table = 0

class EasingtonSearchParser(ApplicationSearchServletParser):
# results table spotter
#table width="100%" border="0" cellspacing="0" cellpadding="0"
_reference_col_no = 1
_location_col_no = 3
_description_col_no = 6
def _checkAttrsForResultsTable(self, attrs):
got_width = False
got_border = False
got_cellspacing = False
got_cellpadding = False
for key, value in attrs:
if key == 'width' and value == "100%":
got_width = True
elif key == 'border' and value == '0':
got_border = True
elif key == 'cellspacing' and value == '0':
got_cellspacing = True
elif key == 'cellpadding' and value == '0':
got_cellpadding = True

if got_width and got_border and got_cellspacing and got_cellpadding:
self._in_results_table = 2
else:
self._in_results_table = 0


class HighPeakSearchParser(ApplicationSearchServletParser):
# results table spotter
# table class="data" width="95%"
_reference_col_no = 1
_location_col_no = 2
_description_col_no = 5
def _checkAttrsForResultsTable(self, attrs):
got_class = False
got_width = False
for key, value in attrs:
if key == 'class' and value == "data":
got_class = True
if key == 'width' and value == "95%":
got_width = True

if got_class and got_width:
self._in_results_table = 2
else:
self._in_results_table = 0


class WearValleySearchParser(ApplicationSearchServletParser):
# results table spotter
# table summary="Table of planning applications that matched your query, showing reference number, received date, and address"
_reference_col_no = 1
_location_col_no = 3
_description_col_no = 4
def _checkAttrsForResultsTable(self, attrs):
got_summary= False
for key, value in attrs:
if key == 'summary' and value == "Table of planning applications that matched your query, showing reference number, received date, and address":
got_summary = True

if got_summary:
self._in_results_table = 2
else:
self._in_results_table = 0


class WellingboroughSearchParser(ApplicationSearchServletParser):
# results table spotter
#table width="100%" border="0"
_reference_col_no = 1
_location_col_no = 3
_description_col_no = 6
def _checkAttrsForResultsTable(self, attrs):
got_width = False
got_border = False
for key, value in attrs:
if key == 'width' and value == "100%":
got_width = True
elif key == 'border' and value == "0":
got_border = True

if got_width and got_border:
self._in_results_table = 2
else:
self._in_results_table = 0

class EalingSearchParser(ApplicationSearchServletParser):
# results table spotter
# table width="100%" cellspacing="0px" border="1px" cellpadding="2px" bordercolor="#FFFFFF"
_reference_col_no = 1
_location_col_no = 3
_description_col_no = 4
def _checkAttrsForResultsTable(self, attrs):
got_width = False
got_cellspacing = False
got_border = False
got_cellpadding = False
got_bordercolor = False
for key, value in attrs:
if key == 'width' and value == "100%":
got_width = True
elif key == 'cellspacing' and value == "0px":
got_cellspacing = True
elif key == 'border' and value == "1px":
got_border = True
elif key == 'cellpadding' and value == "2px":
got_cellpadding = True
elif key == 'bordercolor' and value == "#FFFFFF":
got_bordercolor = True

if got_width and got_cellspacing and got_border and got_cellpadding and got_bordercolor:
self._in_results_table = 2
else:
self._in_results_table = 0


class HaringeySearchParser(ApplicationSearchServletParser):
# results table spotter
# summary="Application Results"
_reference_col_no = 1
_location_col_no = 2
_description_col_no = 5
def _checkAttrsForResultsTable(self, attrs):
got_summary= False
for key, value in attrs:
if key == 'summary' and value == "Application Results":
got_summary = True

if got_summary:
self._in_results_table = 2
else:
self._in_results_table = 0


class DenbighshireSearchParser(ApplicationSearchServletParser):
# results table spotter
#table width="100%" border="0"
_reference_col_no = 1
_location_col_no = 3
_description_col_no = 5
def _checkAttrsForResultsTable(self, attrs):
got_width = False
got_border = False
for key, value in attrs:
if key == 'width' and value == "100%":
got_width = True
elif key == 'border' and value == "0":
got_border = True

if got_width and got_border:
self._in_results_table = 2
else:
self._in_results_table = 0


if __name__ == "__main__":
#parser = CoventrySearchParser("Coventry", "Coventry", "http://planning.coventry.gov.uk")
#print parser.getResults(28,3,2007)
#parser = AllerdaleSearchParser("Allerdale", "Allerdale", "http://planning.allerdale.gov.uk")
#print parser.getResults(28,3,2007)
#parser = AlnwickSearchParser("Alnwick", "Alnwick", "http://services.castlemorpeth.gov.uk:7777")
#print parser.getResults(28,3,2007)
#parser = BarrowSearchParser("Barrow", "Barrow", "http://localportal.barrowbc.gov.uk")
#print parser.getResults(28,3,2007)
#parser = HartlepoolSearchParser("Hartlepool", "Hartlepool", "http://eforms.hartlepool.gov.uk:7777")
#print parser.getResults(28,3,2007)
#parser = NorthWarksSearchParser("North Warwickshire", "North Warks", "http://planning.northwarks.gov.uk")
#print parser.getResults(28,3,2007)
#parser = StHelensSearchParser("St Helens", "St Helens", "http://212.248.225.150:8080")
#print parser.getResults(28,3,2007)
#parser = EasingtonSearchParser("Easington", "Easington", "http://planning.easington.gov.uk")
#print parser.getResults(28,3,2007)
#parser = HighPeakSearchParser("High Peak", "High Peak", "http://planning.highpeak.gov.uk")
#print parser.getResults(20,3,2007)
#parser = WearValleySearchParser("Wear Valley", "Wear Valley", "http://planning.wearvalley.gov.uk")
#print parser.getResults(20,3,2007)
#parser = WellingboroughSearchParser("Wellingborough", "Wellingborough", "http://planning.wellingborough.gov.uk")
#print parser.getResults(20,3,2007)
#parser = EalingSearchParser("Ealing", "Ealing", "http://www.pam.ealing.gov.uk")
#print parser.getResults(20,3,2007)
#parser = HaringeySearchParser("Haringey", "Haringey", "http://www.planningservices.haringey.gov.uk")
#print parser.getResults(20,3,2007)
#parser = DenbighshireSearchParser("Denbighshire", "Denbighshire", "http://planning.denbighshire.gov.uk")
#print parser.getResults(20,3,2007)
pass

+ 0
- 33
cgi-bin/Aylesbury Vale.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Aylesbury Vale District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Aylesbury Vale District Council"
authority_short_name = "Aylesbury Vale"
base_url = "http://eplanning.aylesburyvaledc.gov.uk/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Babergh.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Babergh District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Babergh District Council"
authority_short_name = "Babergh"
base_url = "http://planning.babergh.gov.uk/dataOnlinePlanning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.BaberghParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Barrow.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Barrow Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Barrow Borough Council"
authority_short_name = "Barrow"
base_url = "http://localportal.barrowbc.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.BarrowSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Basildon.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Basildon District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Basildon District Council"
authority_short_name = "Basildon"
base_url = "http://planning.basildon.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Basingstoke and Deane.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Basingstoke and Deane Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Basingstoke and Deane Borough Council"
authority_short_name = "Basingstoke and Deane"
base_url = "http://planning.basingstoke.gov.uk/DCOnline2/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.BasingstokeParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bassetlaw.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bassetlaw District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bassetlaw District Council"
authority_short_name = "Bassetlaw"
base_url = "http://www.bassetlaw.gov.uk/planning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.BassetlawParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bath.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bath and North East Somerset.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bath and North East Somerset"
authority_short_name = "Bath"
base_url = "http://planning.bathnes.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bexley.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bexley Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bexley Council"
authority_short_name = "Bexley"
base_url = "http://publicaccess.bexley.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Blaby.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Blaby District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Blaby District Council"
authority_short_name = "Blaby"
base_url = "http://www.blaby.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bolsover.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bolsover District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bolsover District Council"
authority_short_name = "Bolsover"
base_url = "http://217.158.161.181/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bracknell Forest.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bracknell Forest Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bracknell Forest Borough Council"
authority_short_name = "Bracknell Forest"
base_url = "https://my.bracknell-forest.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bridgnorth.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bridgnorth District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bridgnorth District Council"
authority_short_name = "Bridgnorth"
base_url = "http://www2.bridgnorth-dc.gov.uk/planning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.PgeSearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.BridgnorthParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bristol.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bristol City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bristol City Council"
authority_short_name = "Bristol"
base_url = "http://e2eweb.bristol-city.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Broads.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Broads Authority.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Broads Authority"
authority_short_name = "Broads"
base_url = "https://planning.broads-authority.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bromley.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for London Borough of Bromley.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "London Borough of Bromley"
authority_short_name = "Bromley"
base_url = "http://planningaccess.bromley.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Buckinghamshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Buckinghamshire County Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Buckinghamshire County Council"
authority_short_name = "Buckinghamshire"
base_url = "http://www.bucksplanning.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Bury.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Bury Metropolitan Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Bury Metropolitan Borough Council"
authority_short_name = "Bury"
base_url = "http://e-planning.bury.gov.uk/ePlanning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.PgeSearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.BuryParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Caradon.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Caradon District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Caradon District Council"
authority_short_name = "Caradon"
base_url = "http://publicaccess.caradon.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Carlisle.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Carlisle City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Carlisle City Council"
authority_short_name = "Carlisle"
base_url = "http://planning.carlisle.gov.uk/acolnet/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.CarlisleParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Chelmsford.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Chelmsford Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Chelmsford Borough Council"
authority_short_name = "Chelmsford"
base_url = "http://web1.chelmsfordbc.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Cherwell.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Cherwell District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Cherwell District Council"
authority_short_name = "Cherwell"
base_url = "http://cherweb.cherwell-dc.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Chiltern.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Chiltern District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Chiltern District Council"
authority_short_name = "Chiltern"
base_url = "https://isa.chiltern.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Chorley.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Chorley Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Chorley Borough Council"
authority_short_name = "Chorley"
base_url = "http://planning.chorley.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/City of London.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for City of London.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "City of London"
authority_short_name = "City of London"
base_url = "http://www.planning.cityoflondon.gov.uk/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Cornwall.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Cornwall County Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Cornwall County Council"
authority_short_name = "Cornwall"
base_url = "http://planapps.cornwall.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Coventry.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Coventry City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Coventry City Council"
authority_short_name = "Coventry"
base_url = "http://planning.coventry.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.CoventrySearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Craven.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Craven District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Craven District Council"
authority_short_name = "Craven"
base_url = "http://www.planning.cravendc.gov.uk/fastweb/"

#print "Content-Type: text/html" # HTML is following
#print

import FastWeb

parser = FastWeb.FastWeb(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Croydon.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for London Borough of Croydon.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "London Borough of Croydon"
authority_short_name = "Croydon"
base_url = "http://planning.croydon.gov.uk/DCWebPages/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.CroydonParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Denbighshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Denbighshire County Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Denbighshire County Council"
authority_short_name = "Denbighshire"
base_url = "http://planning.denbighshire.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.DenbighshireSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Derby.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Derby City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Derby City Council"
authority_short_name = "Derby"
base_url = "http://195.224.106.204/scripts/planningpages02%5CXSLPagesDC_DERBY%5CDCWebPages/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.DerbyParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Doncaster.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Doncaster Metropolitan Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Doncaster Metropolitan Borough Council"
authority_short_name = "Doncaster"
base_url = "http://local.doncaster.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Dundee.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Dundee City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Dundee City Council"
authority_short_name = "Dundee"
base_url = "http://bwarrant.dundeecity.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Durham.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Durham City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Durham City Council"
authority_short_name = "Durham"
base_url = "http://publicaccess.durhamcity.gov.uk/publicaccess/dc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Ealing.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Ealing Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Ealing Council"
authority_short_name = "Ealing"
base_url = "http://www.pam.ealing.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.EalingSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Easington.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for District of Easington.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "District of Easington"
authority_short_name = "Easington"
base_url = "http://planning.easington.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.EasingtonSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/East Devon.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for East Devon District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "East Devon District Council"
authority_short_name = "East Devon"
base_url = "http://planning.eastdevon.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/East Dorset.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for East Dorset District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "East Dorset District Council"
authority_short_name = "East Dorset"
base_url = "http://193.243.228.16/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/East Lindsey.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for East Lindsey District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "East Lindsey District Council"
authority_short_name = "East Lindsey"
base_url = "http://www.e-lindsey.gov.uk/planning/AcolnetCGI.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.EastLindseyParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Eastleigh.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Eastleigh Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Eastleigh Borough Council"
authority_short_name = "Eastleigh"
base_url = "http://www.eastleigh.gov.uk/FastWEB/"

#print "Content-Type: text/html" # HTML is following
#print

import FastWeb

parser = FastWeb.FastWeb(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Eden.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Eden District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Eden District Council"
authority_short_name = "Eden"
base_url = "http://eforms.eden.gov.uk/fastweb/"

#print "Content-Type: text/html" # HTML is following
#print

import FastWeb

parser = FastWeb.FastWeb(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Edinburgh.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for The City of Edinburgh Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "The City of Edinburgh Council"
authority_short_name = "Edinburgh"
base_url = "http://citydev-portal.edinburgh.gov.uk/publicaccess/dc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Epsom and Ewell.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Epsom and Ewell Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Epsom and Ewell Borough Council"
authority_short_name = "Epsom and Ewell"
base_url = "http://eplanning.epsom-ewell.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 207
cgi-bin/FastWeb.py View File

@@ -1,207 +0,0 @@

import urllib2
import HTMLParser
import urlparse
import datetime

from PlanningUtils import getPostcodeFromText, PlanningAuthorityResults, PlanningApplication

# example url
# http://www.planning.cravendc.gov.uk/fastweb/results.asp?Scroll=1&DateReceivedStart=1%2F1%2F2007&DateReceivedEnd=1%2F7%2F2007

search_form_url_end = "results.asp?Scroll=%(scroll)d&DateReceivedStart=%(day)d%%2F%(month)d%%2F%(year)d&DateReceivedEnd=%(day)d%%2F%(month)d%%2F%(year)d"

# for testing paging
#search_form_url_end = "results.asp?Scroll=%(scroll)d&DateReceivedStart=10%%2F7%%2F2007&DateReceivedEnd=%(day)d%%2F%(month)d%%2F%(year)d"

comment_url_end = "comment.asp?AltRef=%s"
info_url_end = "detail.asp?AltRef=%s"

class FastWeb:
def __init__(self,
authority_name,
authority_short_name,
base_url,
debug=False):
self.authority_name = authority_name
self.authority_short_name = authority_short_name
self.base_url = base_url

self.debug = debug

# The object which stores our set of planning application results
self._results = PlanningAuthorityResults(self.authority_name, self.authority_short_name)
def getResultsByDayMonthYear(self, day, month, year):
requested_date = datetime.date(year, month, day)

# What we should do:

#1) Work out if the page we get back is a results page or the search page again. The search page indicates no results for this day.

# Assuming we have a results page:
#2) Get the total number of results out of it. We can use this to work out how many times we need to request the page, and with what scroll numbers

#3) Iterate over scroll numbers.

scroll = 0
first_time = True
number_of_results = 0

while first_time or scroll * 20 < number_of_results:
scroll += 1
this_search_url = search_form_url_end %{"scroll":scroll, "day":day, "month":month, "year":year}
url = urlparse.urljoin(self.base_url, this_search_url)
response = urllib2.urlopen(url)

contents = response.read()

if first_time:
# We can now use the returned URL to tell us if there were no results.
returned_url = response.geturl()

# example URL of no results page
# http://www.planning.cravendc.gov.uk/fastweb/search.asp?Results=none&
if returned_url.count("search.asp"):
# We got back the search page, there were no results for this date
break
results_page_parser = FastWebResultsPageParser(self._results, requested_date, self.base_url)
results_page_parser.feed(contents)

if first_time:
number_of_results += results_page_parser.number_of_results
first_time = False

return self._results
def getResults(self, day, month, year):
return self.getResultsByDayMonthYear(int(day), int(month), int(year)).displayXML()



# States

STARTING = 1
GOT_RESULTS_COUNT = 2
IN_RESULTS_TABLE = 3
IN_RESULTS_TABLE_TD = 4
IN_INNER_TABLE = 5
FINISHED = -1


class FastWebResultsPageParser(HTMLParser.HTMLParser):
def __init__(self, results, requested_date, base_url):

self.results = results

self.requested_date = requested_date
self.base_url = base_url


HTMLParser.HTMLParser.__init__(self)

# We'll use this to store the number of results returned for this search
self.number_of_results = None

self._state = STARTING
self._td_count = None

self._data_list = []

# This will store the planning application we are currently working on.
self._current_application = None
def get_data(self, flush=True):
data = " ".join(self._data_list)

if flush:
self.flush_data()
return data

def flush_data(self):
self._data_list = []

def handle_starttag(self, tag, attrs):
if self._state == STARTING and tag == "input":
self._state = GOT_RESULTS_COUNT

# This is where the number of results returned is stored
attr_dict = {}
for attr_name, attr_value in attrs:
attr_dict[attr_name] = attr_value
if attr_dict.get("id") == "RecCount":
self.number_of_results = int(attr_dict.get("value"))

elif self._state == GOT_RESULTS_COUNT and tag == "table":
self._state = IN_RESULTS_TABLE

elif self._state == IN_RESULTS_TABLE and tag == "td":
self._state = IN_RESULTS_TABLE_TD
elif self._state == IN_RESULTS_TABLE_TD and tag == "table":
self._state = IN_INNER_TABLE
self._td_count = 0
self._current_application = PlanningApplication()
self._current_application.date_received = self.requested_date

elif self._state == IN_INNER_TABLE and tag == "td":
self._td_count += 1
self.flush_data()

def handle_endtag(self, tag):
if self._state == IN_INNER_TABLE and tag == "table":
# The next if should never be false, but it pays to be careful :-)
if self._current_application.council_reference is not None:
self.results.addApplication(self._current_application)
self._state = IN_RESULTS_TABLE_TD

elif self._state == IN_RESULTS_TABLE_TD and tag == "td":
self._state = FINISHED
elif self._state == IN_INNER_TABLE and tag == "td":
if self._td_count == 2:
# This data is the App No.
council_reference = self.get_data().strip()
self._current_application.council_reference = council_reference

# This also gives us everything we need for the info and comment urls
self._current_application.info_url = urlparse.urljoin(self.base_url, info_url_end %(council_reference))
self._current_application.comment_url = urlparse.urljoin(self.base_url, comment_url_end %(council_reference))
elif self._td_count == 4:
# This data is the address
self._current_application.address = self.get_data().strip()
self._current_application.postcode = getPostcodeFromText(self._current_application.address)
elif self._td_count == 7:
# This data is the description
self._current_application.description = self.get_data().strip()

def handle_data(self, data):
self._data_list.append(data)

# for debug purposes

#cravenparser = FastWeb("Craven District Council", "Craven", "http://www.planning.cravendc.gov.uk/fastweb/")

#eastleighparser = FastWeb("EastLeigh Borough Council", "Eastleigh", "http://www.eastleigh.gov.uk/FastWEB/")


#suttonparser = FastWeb("Sutton", "Sutton", "http://82.43.4.135/FASTWEB/")

#print eastleighparser.getResults(10,8,2007)
#print cravenparser.getResults(25,12,2006)
#print suttonparser.getResults(10,8,2007)

#south_lakeland_parser = FastWeb("South Lakeland", "South Lakeland", "http://www.southlakeland.gov.uk/fastweb/")

#print south_lakeland_parser.getResults(27,11,2006)


+ 0
- 33
cgi-bin/Fenland.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Fenland District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Fenland District Council"
authority_short_name = "Fenland"
base_url = "http://www.fenland.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Fylde.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Fylde Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Fylde Borough Council"
authority_short_name = "Fylde"
base_url = "http://www2.fylde.gov.uk/planning/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.FyldeParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Gateshead.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Gateshead Metropolitan Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Gateshead Metropolitan Borough Council"
authority_short_name = "Gateshead"
base_url = "http://planning.gateshead.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Gedling.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Gedling Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Gedling Borough Council"
authority_short_name = "Gedling"
base_url = "http://publicaccess.gedling.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Gloucestershire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Gloucestershire County Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Gloucestershire County Council"
authority_short_name = "Gloucestershire"
base_url = "http://planning.gloucestershire.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Gravesham.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Gravesham Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Gravesham Borough Council"
authority_short_name = "Gravesham"
base_url = "http://195.102.67.4/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Hambleton.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Hambleton District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Hambleton District Council"
authority_short_name = "Hambleton"
base_url = "http://planning.hambleton.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Hammersmith and Fulham.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for London Borough Of Hammersmith and Fulham.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "London Borough Of Hammersmith and Fulham"
authority_short_name = "Hammersmith and Fulham"
base_url = "http://www.apps.lbhf.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Haringey.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Haringey Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Haringey Council"
authority_short_name = "Haringey"
base_url = "http://www.planningservices.haringey.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.HaringeySearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Harlow.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Harlow Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Harlow Council"
authority_short_name = "Harlow"
base_url = "http://planning.harlow.gov.uk/PlanningSearch/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.HarlowParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Harrogate.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Harrogate Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Harrogate Borough Council"
authority_short_name = "Harrogate"
base_url = "http://publicaccess.harrogate.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Hart.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Hart District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Hart District Council"
authority_short_name = "Hart"
base_url = "http://publicaccess.hart.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Hartlepool.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Hartlepool Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Hartlepool Borough Council"
authority_short_name = "Hartlepool"
base_url = "http://eforms.hartlepool.gov.uk:7777/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.HartlepoolSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Hertsmere.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Hertsmere Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Hertsmere Borough Council"
authority_short_name = "Hertsmere"
base_url = "http://www2.hertsmere.gov.uk/ACOLNET/DCOnline//acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.HertsmereParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/High Peak.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for High Peak Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "High Peak Borough Council"
authority_short_name = "High Peak"
base_url = "http://planning.highpeak.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.HighPeakSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Hinkley and Bosworth.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Hinkley and Bosworth Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Hinkley and Bosworth Borough Council"
authority_short_name = "Hinkley and Bosworth"
base_url = "https://cx.hinckley-bosworth.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Huntingdonshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Huntingdonshire District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Huntingdonshire District Council"
authority_short_name = "Huntingdonshire"
base_url = "http://planning.huntsdc.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Kerrier.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Kerrier District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Kerrier District Council"
authority_short_name = "Kerrier"
base_url = "http://publicaccess.kerrier.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Knowsley.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Knowsley Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Knowsley Council"
authority_short_name = "Knowsley"
base_url = "http://publicaccess.knowsley.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Lancaster.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Lancaster City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Lancaster City Council"
authority_short_name = "Lancaster"
base_url = "http://planapps.lancaster.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Lewisham.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for London Borough of Lewisham.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "London Borough of Lewisham"
authority_short_name = "Lewisham"
base_url = "http://acolnet.lewisham.gov.uk/lewis-xslpagesdc/acolnetcgi.exe?ACTION=UNWRAP&RIPNAME=Root.PgeSearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.LewishamParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Luton.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Luton Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Luton Borough Council"
authority_short_name = "Luton"
base_url = "http://www.eplan.luton.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Malvern Hills.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Malvern Hills District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Malvern Hills District Council"
authority_short_name = "Malvern Hills"
base_url = "http://public.malvernhills.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Manchester.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Manchester City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Manchester City Council"
authority_short_name = "Manchester"
base_url = "http://www.publicaccess.manchester.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Mansfield.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Mansfield District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Mansfield District Council"
authority_short_name = "Mansfield"
base_url = "http://www.mansfield.gov.uk/Fastweb23/"

#print "Content-Type: text/html" # HTML is following
#print

import FastWeb

parser = FastWeb.FastWeb(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Mid Devon.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Mid Devon District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Mid Devon District Council"
authority_short_name = "Mid Devon"
base_url = "http://planning.middevon.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Milton Keynes.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Milton Keynes Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Milton Keynes Council"
authority_short_name = "Milton Keynes"
base_url = "http://publicaccess.milton-keynes.gov.uk/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Moray.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Moray Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Moray Council"
authority_short_name = "Moray"
base_url = "http://public.moray.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 133
cgi-bin/MultipartPostHandler.py View File

@@ -1,133 +0,0 @@
####
# 02/2006 Will Holcomb <wholcomb@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#

# I have edited out a bit in the middle of this which reverts to a normal
# post with "application/x-www-form-urlencoded" content-type when there are
# no files.
# Duncan 5/5/2007

"""
Usage:
Enables the use of multipart/form-data for posting forms

Inspirations:
Upload files in python:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306
urllib2_file:
Fabien Seisen: <fabien@seisen.org>

Example:
import MultipartPostHandler, urllib2, cookielib

cookies = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies),
MultipartPostHandler.MultipartPostHandler)
params = { "username" : "bob", "password" : "riviera",
"file" : open("filename", "rb") }
opener.open("http://wwww.bobsite.com/upload/", params)

Further Example:
The main function of this file is a sample which downloads a page and
then uploads it to the W3C validator.
"""

import urllib
import urllib2
import mimetools, mimetypes
import os, stat

class Callable:
def __init__(self, anycallable):
self.__call__ = anycallable

# Controls how sequences are uncoded. If true, elements may be given multiple values by
# assigning a sequence.
doseq = 1

class MultipartPostHandler(urllib2.BaseHandler):
handler_order = urllib2.HTTPHandler.handler_order - 10 # needs to run first

def http_request(self, request):
data = request.get_data()
if data is not None and type(data) != str:
v_files = []
v_vars = []
try:
for(key, value) in data.items():
if type(value) == file:
v_files.append((key, value))
else:
v_vars.append((key, value))
except TypeError:
systype, value, traceback = sys.exc_info()
raise TypeError, "not a valid non-string sequence or mapping object", traceback

boundary, data = self.multipart_encode(v_vars, v_files)
contenttype = 'multipart/form-data; boundary=%s' % boundary
if(request.has_header('Content-Type')
and request.get_header('Content-Type').find('multipart/form-data') != 0):
print "Replacing %s with %s" % (request.get_header('content-type'), 'multipart/form-data')
request.add_unredirected_header('Content-Type', contenttype)

request.add_data(data)
return request

def multipart_encode(vars, files, boundary = None, buffer = None):
if boundary is None:
boundary = mimetools.choose_boundary()
if buffer is None:
buffer = ''
for(key, value) in vars:
buffer += '--%s\r\n' % boundary
buffer += 'Content-Disposition: form-data; name="%s"' % key
buffer += '\r\n\r\n' + value + '\r\n'
for(key, fd) in files:
file_size = os.fstat(fd.fileno())[stat.ST_SIZE]
filename = fd.name.split('/')[-1]
contenttype = mimetypes.guess_type(filename)[0] or 'application/octet-stream'
buffer += '--%s\r\n' % boundary
buffer += 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n' % (key, filename)
buffer += 'Content-Type: %s\r\n' % contenttype
# buffer += 'Content-Length: %s\r\n' % file_size
fd.seek(0)
buffer += '\r\n' + fd.read() + '\r\n'
buffer += '--%s--\r\n\r\n' % boundary
return boundary, buffer
multipart_encode = Callable(multipart_encode)

https_request = http_request

## def main():
## import tempfile, sys

## validatorURL = "http://validator.w3.org/check"
## opener = urllib2.build_opener(MultipartPostHandler)

## def validateFile(url):
## temp = tempfile.mkstemp(suffix=".html")
## os.write(temp[0], opener.open(url).read())
## params = { "ss" : "0", # show source
## "doctype" : "Inline",
## "uploaded_file" : open(temp[1], "rb") }
## print opener.open(validatorURL, params).read()
## os.remove(temp[1])

## if len(sys.argv[1:]) > 0:
## for arg in sys.argv[1:]:
## validateFile(arg)
## else:
## validateFile("http://www.google.com")

## if __name__=="__main__":
## main()

+ 0
- 33
cgi-bin/NW Leicestershire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for North West Leicestershire District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "North West Leicestershire District Council"
authority_short_name = "NW Leicestershire"
base_url = "http://paccess.nwleics.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/New Forest DC.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for New Forest District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "New Forest District Council"
authority_short_name = "New Forest DC"
base_url = "http://web3.newforest.gov.uk/planningonline/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.NewForestDCParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/New Forest NP.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for New Forest National Park.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "New Forest National Park"
authority_short_name = "New Forest NP"
base_url = "http://web01.newforestnpa.gov.uk/planningpages/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.NewForestNPParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Newcastle-under-Lyme.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Newcastle-under-Lyme Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Newcastle-under-Lyme Borough Council"
authority_short_name = "Newcastle-under-Lyme"
base_url = "http://publicaccess.newcastle-staffs.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Newcastle.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Newcastle City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Newcastle City Council"
authority_short_name = "Newcastle"
base_url = "http://gispublic.newcastle.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Newham.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for London Borough Of Newham.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "London Borough Of Newham"
authority_short_name = "Newham"
base_url = "http://pacaps.newham.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/North Hertfordshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for North Hertfordshire District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "North Hertfordshire District Council"
authority_short_name = "North Hertfordshire"
base_url = "http://www.north-herts.gov.uk/dcdataonline/Pages/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.PgeSearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.NorthHertfordshireParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/North Tyneside.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for North Tyneside Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "North Tyneside Council"
authority_short_name = "North Tyneside"
base_url = "http://publicaccess.northtyneside.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/North Warwickshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for North Warwickshire Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "North Warwickshire Borough Council"
authority_short_name = "North Warwickshire"
base_url = "http://planning.northwarks.gov.uk/"

#print "Content-Type: text/html" # HTML is following
#print

import ApplicationSearchServletParser

parser = ApplicationSearchServletParser.NorthWarksSearchParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/North Wiltshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for North Wiltshire District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "North Wiltshire District Council"
authority_short_name = "North Wiltshire"
base_url = "http://planning.northwilts.gov.uk/DCOnline/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.NorthWiltshireParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Northumberland.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Northumberland County Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Northumberland County Council"
authority_short_name = "Northumberland"
base_url = "http://planning.northumberland.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Oadby and Wigston.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for The Borough of Oadby and Wigston.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "The Borough of Oadby and Wigston"
authority_short_name = "Oadby and Wigston"
base_url = "http://web.owbc.net/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Oldham.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Oldham District Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Oldham District Council"
authority_short_name = "Oldham"
base_url = "http://planning.oldham.gov.uk/planning//acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.pgesearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.OldhamParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Oswestry.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Oswestry Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Oswestry Borough Council"
authority_short_name = "Oswestry"
base_url = "http://193.114.205.78/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Perthshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Perth and Kinross Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Perth and Kinross Council"
authority_short_name = "Perthshire"
base_url = "http://193.63.61.22/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Peterborough.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Peterborough City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Peterborough City Council"
authority_short_name = "Peterborough"
base_url = "http://194.72.246.15/publicaccess/dc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 102
cgi-bin/PlanningUtils.py View File

@@ -1,102 +0,0 @@
__auth__ = None

import re

date_format = "%d/%m/%Y"


def xmlQuote(text):
# Change &s to &amp;s
# I suspect there is probably some standard python
# function I should be using for this...
return text.replace('&', '&amp;')

def fixNewlines(text):
# This can be used to sort out windows newlines
return text.replace("\r\n","\n")

# So what can a postcode look like then?
# This list of formats comes from http://www.mailsorttechnical.com/frequentlyaskedquestions.cfm
#AN NAA M1 1AA
#ANN NAA M60 1NW
#AAN NAA CR2 6XH
#AANN NAA DN55 1PT
#ANA NAA W1A 1HP
#AANA NAA EC1A 1BB

postcode_regex = re.compile("[A-Z][A-Z]?\d(\d|[A-Z])? ?\d[A-Z][A-Z]")

def getPostcodeFromText(text):
"""This function takes a piece of text and returns the first
bit of it that looks like a postcode."""

postcode_match = postcode_regex.search(text)

if postcode_match is not None:
return postcode_match.group()

class PlanningAuthorityResults:
"""This class represents a set of results of a planning search.

This should probably be separated out so that it can be used for
authorities other than Cherwell.
"""

def __init__(self, authority_name, authority_short_name):
self.authority_name = authority_name
self.authority_short_name = authority_short_name
# this will be a list of PlanningApplication objects
self.planning_applications = []


def addApplication(self, application):
self.planning_applications.append(application)

def __repr__(self):
return self.displayXML()
def displayXML(self):
"""This should display the contents of this object in the planningalerts format.
i.e. in the same format as this one:
http://www.planningalerts.com/lambeth.xml
"""

applications_bit = "".join([x.displayXML() for x in self.planning_applications])

return "<planning>\n" +\
"<authority_name>%s</authority_name>\n" %self.authority_name +\
"<authority_short_name>%s</authority_short_name>\n" %self.authority_short_name +\
"<applications>\n" + applications_bit +\
"</applications>\n" +\
"</planning>\n"



class PlanningApplication:
def __init__(self, no_postcode_default='No postcode'):
self.council_reference = None
self.address = None
self.postcode = no_postcode_default
self.description = None
self.info_url = None
self.comment_url = None

# expecting this as a datetime.date object
self.date_received = None

def __repr__(self):
return self.displayXML()
def displayXML(self):
#print self.council_reference, self.address, self.postcode, self.description, self.info_url, self.comment_url, self.date_received
return "<application>\n" +\
"<council_reference>%s</council_reference>\n" %xmlQuote(self.council_reference) +\
"<address>%s</address>\n" %xmlQuote(self.address) +\
"<postcode>%s</postcode>\n" %self.postcode +\
"<description>%s</description>\n" %xmlQuote(self.description) +\
"<info_url>%s</info_url>\n" %xmlQuote(self.info_url) +\
"<comment_url>%s</comment_url>\n" %xmlQuote(self.comment_url) +\
"<date_received>%s</date_received>\n" %self.date_received.strftime(date_format) +\
"</application>\n"

+ 0
- 33
cgi-bin/Portsmouth.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Portsmouth City Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Portsmouth City Council"
authority_short_name = "Portsmouth"
base_url = "http://planning.portsmouth.gov.uk/PublicAccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 351
cgi-bin/PublicAccess.py View File

@@ -1,351 +0,0 @@
#!/usr/local/bin/python

import urllib, urllib2
import HTMLParser
import urlparse
import datetime, time

import cookielib

cookie_jar = cookielib.CookieJar()


from PlanningUtils import fixNewlines, getPostcodeFromText, PlanningAuthorityResults, PlanningApplication


search_form_url_end = "DcApplication/application_searchform.aspx"
search_results_url_end = "DcApplication/application_searchresults.aspx"
comments_url_end = "DcApplication/application_comments_entryform.aspx"

class PublicAccessParser(HTMLParser.HTMLParser):
"""This is the class which parses the PublicAccess search results page.
"""

def __init__(self,
authority_name,
authority_short_name,
base_url,
debug=False):
HTMLParser.HTMLParser.__init__(self)

self.authority_name = authority_name
self.authority_short_name = authority_short_name
self.base_url = base_url

self.debug = debug

# this will change to True when we enter the table of results
self._in_results_table = False

# this will be set to True when we have passed the header row
# in the results table
self._past_header_row = False

# this will be true when we are in a <td> in the results table
self._in_td = False

# For each row, this will say how many tds we have seen so far
self._td_count = 0

# The object which stores our set of planning application results
self._results = PlanningAuthorityResults(self.authority_name, self.authority_short_name)

# This will store the planning application we are currently working on.
self._current_application = None

def handle_starttag(self, tag, attrs):
if tag == "table":
self.handle_start_table(attrs)
# we are only interested in tr tags if we are in the results table
elif self._in_results_table and tag == "tr":
self.handle_start_tr(attrs)
# we are only interested in td tags if we are in the results table
elif self._in_results_table and tag == "td":
self.handle_start_td(attrs)
# we are only interested in <a> tags if we are in the 6th td in
# the results table.
# UPDATE: It seems that, in the case of Chiltern, we are interested in
# td 5.
elif self._in_td and (self._td_count == 5 or self._td_count == 6) and tag == "a":
self.handle_start_a(attrs)
# If the tag is not one of these then we aren't interested

def handle_endtag(self, tag):
# we only need to consider end tags if we are in the results table
if self._in_results_table:
if tag == "table":
self.handle_end_table()
if tag == "tr":
self.handle_end_tr()
if tag == "td":
self.handle_end_td()

def handle_start_table(self, attrs):
for attr,value in attrs:
if attr == "class":
if value == "cResultsForm":
self._in_results_table = True
break

def handle_end_table(self):
# If we see an end table tag, then note that we have left the
# results table. This method is only called if we are in that table.
self._in_results_table = False

def handle_start_tr(self, attrs):
# The first tr we meet in the results table is just headers
# We will set a flag at the end of that tr to avoid creating
# a blank PlanningApplication
if self._past_header_row:
# Create a candidate result object
self._current_application = PlanningApplication()
self._td_count = 0

def handle_end_tr(self):
# If we are in the results table, and not finishing the header row
# append the current result to the results list.
if self._past_header_row:
self._results.addApplication(self._current_application)
else:
# The first row of the results table is headers
# We want to do nothing until after it
self._past_header_row = True
def handle_start_td(self, attrs):
# increase the td count by one
self._td_count += 1
# note that we are now in a td
self._in_td = True

def handle_end_td(self):
# note that we are now not in a td
self._in_td = False

def handle_start_a(self, attrs):
# this method is only getting called if we are in the
# 6th td of a non-header row of the results table.

# go through the attributes of the <a> looking for one
# named 'href'
for attr,value in attrs:
if attr == "href":
# the value of this tag is a relative url.
# parse it so we can get the query string from it
parsed_info_url = urlparse.urlparse(value)
# the 4th part of the tuple is the query string
query_string = parsed_info_url[4]

# join this query string to the search URL, and store this as
# the info URL of the current planning application
self._current_application.info_url = urlparse.urljoin(self.base_url, value)

# Join this query string to the comments URL, and store this as
# the comments URL of the current planning application
comments_url = urlparse.urljoin(self.base_url, comments_url_end)
self._current_application.comment_url = "?".join([comments_url, query_string])

# while we're here, let's follow some links to find the postcode...
# the postcode is in an input tag in the property page. This page
# can be found by following the info url.
# The newlines in the info page need fixing.
info_file_contents = fixNewlines(urllib2.urlopen(self._current_application.info_url).read())
info_file_parser = PublicAccessInfoPageParser()
info_file_parser.feed(info_file_contents)

property_page_url = urlparse.urljoin(self._current_application.info_url, info_file_parser.property_page_url)
# the newlines in this page need fixing
property_file_contents = fixNewlines(urllib2.urlopen(property_page_url).read())
property_file_parser = PublicAccessPropertyPageParser()
property_file_parser.feed(property_file_contents)

# Set the postcode on the current planning application from the
# one found on the property page
if property_file_parser.postcode is not None:
self._current_application.postcode = property_file_parser.postcode
else:
# If there is no postcode in here, then we'll have to make do with regexing one out of the address.
self._current_application.postcode = getPostcodeFromText(self._current_application.address)

# There is no need for us to look at any more attributes.
break

def handle_data(self, data):
if self._in_td:
# The first td contains the reference
if self._td_count == 1:
self._current_application.council_reference = data
# The second td contains the date the application was received
elif self._td_count == 2:
year, month, day = time.strptime(data, "%d/%m/%Y")[:3]
received_date = datetime.date(year, month, day)

self._current_application.date_received = received_date
# The third td contains the address
elif self._td_count == 3:
#data = data.replace("^M","\n")
self._current_application.address = data
# The fourth td contains the description
elif self._td_count == 4:
self._current_application.description = data
# 5 is status - we don't need it.
# 6 is a button - this is where we will get our postcode,
# comment_url, and info_url from (when handling the <a> tag).


def getResultsByDayMonthYear(self, day, month, year):
# First download the search form (in order to get a session cookie
search_form_request = urllib2.Request(urlparse.urljoin(self.base_url, search_form_url_end))
search_form_response = urllib2.urlopen(search_form_request)
cookie_jar.extract_cookies(search_form_response, search_form_request)

# We are only doing this first search in order to get a cookie
# The paging on the site doesn't work with cookies turned off.

search_data1 = urllib.urlencode({"searchType":"ADV",
"caseNo":"",
"PPReference":"",
"AltReference":"",
"srchtype":"",
"srchstatus":"",
"srchdecision":"",
"srchapstatus":"",
"srchappealdecision":"",
"srchwardcode":"",
"srchparishcode":"",
"srchagentdetails":"",
"srchDateReceivedStart":"%(day)02d/%(month)02d/%(year)d" %{"day":day ,"month": month ,"year": year},
"srchDateReceivedEnd":"%(day)02d/%(month)02d/%(year)d" %{"day":day, "month":month, "year":year} })

if self.debug:
print search_data1


search_url = urlparse.urljoin(self.base_url, search_results_url_end)
request1 = urllib2.Request(search_url, search_data1)
cookie_jar.add_cookie_header(request1)
response1 = urllib2.urlopen(request1)

# This search is the one we will actually use.
# a maximum of 100 results are returned on this site,
# hence setting "pagesize" to 100. I doubt there will ever
# be more than 100 in one day in PublicAccess...
# "currentpage" = 1 gets us to the first page of results
# (there will only be one anyway, as we are asking for 100 results...)

#http://planning.york.gov.uk/PublicAccess/tdc/DcApplication/application_searchresults.aspx?szSearchDescription=Applications%20received%20between%2022/02/2007%20and%2022/02/2007&searchType=ADV&bccaseno=&currentpage=2&pagesize=10&module=P3

search_data2 = urllib.urlencode((("szSearchDescription","Applications received between %(day)02d/%(month)02d/%(year)d and %(day)02d/%(month)02d/%(year)d"%{"day":day ,"month": month ,"year": year}), ("searchType","ADV"), ("bccaseno",""), ("currentpage","1"), ("pagesize","100"), ("module","P3")))

if self.debug:
print search_data2

# This time we want to do a get request, so add the search data into the url
request2_url = urlparse.urljoin(self.base_url, search_results_url_end + "?" + search_data2)

request2 = urllib2.Request(request2_url)

# add the cookie we stored from our first search
cookie_jar.add_cookie_header(request2)

response2 = urllib2.urlopen(request2)

contents = fixNewlines(response2.read())

if self.debug:
print contents

self.feed(contents)

return self._results


def getResults(self, day, month, year):
return self.getResultsByDayMonthYear(int(day), int(month), int(year)).displayXML()




class PublicAccessInfoPageParser(HTMLParser.HTMLParser):
"""A parser to get the URL for the property details page out of the
info page (this url is needed in order to get the postcode of the
application.
"""

def __init__(self):
HTMLParser.HTMLParser.__init__(self)

self.property_page_url = None

def handle_starttag(self, tag, attrs):
"""The URL of the property details page is contained in an <a> tag in
an attribute with key 'A_btnPropertyDetails'. There is some garbage on
either side of it which we will have to clear up before storing it...

We go through the <a> tags looking for one with an attribute with
key 'id' and value 'A_btnPropertyDetails'. When we find it we go through
its attributes looking for one with key 'href' - the value of this attribute
contains the URL we want, after a bit of tidying up.

Once we have got the URL, there is no need for us to look at any more <a> tags.
"""
if tag == "a" and self.property_page_url is None:
#print attrs
if attrs.count(("id","A_btnPropertyDetails")) > 0:
for attr,value in attrs:
if attr == "href":
the_link = value

# this may have some garbage on either side of it...
# let's strip that off

# If the stripping fails, take the whole link

# the garbage on the left is separated by whitespace.
# the garbage on the right is separated by a "'".
try:
self.property_page_url = the_link.split()[1].split("'")[0]
except IndexError:
self.property_page_url = the_link


class PublicAccessPropertyPageParser(HTMLParser.HTMLParser):
"""A parser to get the postcode out of the property details page."""
def __init__(self):
HTMLParser.HTMLParser.__init__(self)

self.postcode = None

def handle_starttag(self, tag, attrs):
"""The postcode is contained in an <input> tag.
This tag has an attribute 'name' with value postcode.
It also has an attribute 'value' with value the postcode of this application.

We go through the input tags looking for one with an attribute with
key 'name' and value 'postcode'. When we find one,
we look through its attributes for one with key 'value' - we store the value of this
attribute as self.postcode.

Once we have the postcode, there is no need to look at any more input tags.
"""
if tag == "input" and self.postcode is None:
if attrs.count(("name","postcode")) > 0:
for attr,value in attrs:
if attr == "value":
self.postcode = value



+ 0
- 5
cgi-bin/README View File

@@ -1,5 +0,0 @@

WARNING - this directory is only for generated files
and files which are automatically copied in.
Anything manually added here will be svn deleted.


+ 0
- 33
cgi-bin/Redditch.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Redditch Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Redditch Borough Council"
authority_short_name = "Redditch"
base_url = "http://access.redditchbc.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Renfrewshire.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Renfrewshire Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Renfrewshire Council"
authority_short_name = "Renfrewshire"
base_url = "http://planning.renfrewshire.gov.uk/acolnetDCpages/acolnetcgi.gov?ACTION=UNWRAP&RIPNAME=Root.PgeSearch"

#print "Content-Type: text/html" # HTML is following
#print

import AcolnetParser

parser = AcolnetParser.RenfrewshireParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

+ 0
- 33
cgi-bin/Rushmoor.cgi View File

@@ -1,33 +0,0 @@
#!/usr/local/bin/python

# This is the parser for Rushmoor Borough Council.
# it is generated from the file CGITemplate

import cgi
import cgitb
#cgitb.enable(display=0, logdir="/tmp")


form = cgi.FieldStorage()
day = form.getfirst('day')
month = form.getfirst('month')
year = form.getfirst('year')


authority_name = "Rushmoor Borough Council"
authority_short_name = "Rushmoor"
base_url = "http://pa-dc.rushmoor.gov.uk/publicaccess/tdc/"

#print "Content-Type: text/html" # HTML is following
#print

import PublicAccess

parser = PublicAccess.PublicAccessParser(authority_name, authority_short_name, base_url)

xml = parser.getResults(day, month, year)


print "Content-Type: text/xml" # XML is following
print
print xml # print the xml

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save