Permalink
Browse files

Merge pull request #20 from gar/master

Tightening up the error checking in the xfn scraping example. Thanks gar! This is the first pull request anyone has sent in so far :)
  • Loading branch information...
2 parents 9fd0361 + 1d4e940 commit b1c0e383b715cc9bd36036ad7c57496408a7cb30 @ptwobrussell committed Apr 18, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 python_code/microformats__xfn_scrape.py
@@ -31,13 +31,13 @@
try:
page = urllib2.urlopen(URL)
-except urllib2.URLError:
- print 'Failed to fetch ' + item
-
-try:
soup = BeautifulSoup(page)
+except urllib2.URLError:
+ print 'Failed to fetch ' + URL
+ sys.exit()
except HTMLParser.HTMLParseError:
- print 'Failed to parse ' + item
+ print 'Failed to parse ' + URL
+ sys.exit()
anchorTags = soup.findAll('a')

0 comments on commit b1c0e38

Please sign in to comment.