Skip to content

Commit

Permalink
Deal with missing postal code
Browse files Browse the repository at this point in the history
  • Loading branch information
timtomch committed Jul 29, 2016
1 parent 7599a7c commit 2d464d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scraper.py
Expand Up @@ -15,7 +15,10 @@ def parse_page(url):
college_url = response.xpath('//*[@class="mem-contact"]/p[2]//a/@href')[0]
college_address = response.xpath('//*[@class="mem-contact"]/p[1]/text()[1]')[0]
college_city = response.xpath('//*[@class="mem-contact"]/p[1]/text()[2]')[0]
college_postalcode = response.xpath('//*[@class="mem-contact"]/p[1]/text()[3]')[0]
try:
college_postalcode = response.xpath('//*[@class="mem-contact"]/p[1]/text()[3]')[0]
except:
college_postalcode = ''

#print "Successfully scraped %s in %s" % (college_name.decode('utf-8'), college_city)

Expand Down

0 comments on commit 2d464d3

Please sign in to comment.