diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-31 17:43:27 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-31 17:43:27 -0600 |
| commit | a2d40d840dac54cebe846803ad38f85327131d43 (patch) | |
| tree | cbc822d4f8a0e8c9b1ce915b9b217ef8e167d36d /lib | |
| parent | b1635e053c68d7a7bf7feb6a8f2321bda48a54d5 (diff) | |
Check for successful response
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/spandx/python/pypi.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/spandx/python/pypi.rb b/lib/spandx/python/pypi.rb index ca91637..ce366c9 100644 --- a/lib/spandx/python/pypi.rb +++ b/lib/spandx/python/pypi.rb @@ -95,7 +95,12 @@ module Spandx def html_from(source, path) url = URI.join(source.uri.to_s, path).to_s - Nokogiri::HTML(http.get(url).body) + response = http.get(url) + if http.ok?(response) + Nokogiri::HTML(response.body) + else + Nokogiri::HTML("<html><head></head><body></body></html>") + end end end end |
