Reputation: 11
while using Mechanize gem in rails and fetching the site https://www.reuters.com/ its giving -> Failed to fetch page: 401 => Net::HTTPUnauthorized for https://www.reuters.com/ -- WWW-Authenticate header missing in response
page = nil
begin
agent = Mechanize.new
page = agent.get(url)
rescue => e
puts "Mechanize Response Headers:"
Rails.logger.error "Failed to fetch page:\n #{e.message}"
end
Upvotes: 0
Views: 18