Skip to content

Commit

Permalink
Ignore error when unable to call out to web to obtain detail data dur…
Browse files Browse the repository at this point in the history
…ing parse.
  • Loading branch information
ezgraphs committed Nov 14, 2011
1 parent d4e4237 commit 0b8e792
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pypi/parse.rb
Expand Up @@ -6,8 +6,13 @@
require 'open-uri'

def get_item(doc,label='Author:', child_tag="span")

(doc/"//ul[@class='nodot']/li/strong[text()='#{label}']../#{child_tag}").inner_text
str=''
begin
str=(doc/"//ul[@class='nodot']/li/strong[text()='#{label}']../#{child_tag}").inner_text
rescue
nil
end
return str
end

doc=Hpricot(open('download/pypy.html'))
Expand Down

0 comments on commit 0b8e792

Please sign in to comment.