From 6a313e5e1b8f14ca3374b198ef8d91ec0e73abe1 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Sun, 21 Jul 2024 17:53:29 -0700 Subject: [PATCH] Set a user-agent header for SFX requests. --- app/models/sfx_data.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/sfx_data.rb b/app/models/sfx_data.rb index 85bb91a56..3d5e3c49c 100644 --- a/app/models/sfx_data.rb +++ b/app/models/sfx_data.rb @@ -60,6 +60,8 @@ def sfx_response Faraday.new(url: sfx_url) do |faraday| faraday.use FaradayMiddleware::FollowRedirects faraday.adapter Faraday.default_adapter + # Set the user agent + faraday.headers['User-Agent'] = 'Mozilla/5.0 (compatible; +https://searchworks.stanford.edu)' end.get rescue Faraday::ConnectionFailed Honeybadger.notify("SFX data for #{sfx_url} failed to load")