From cc6d8acb3f21593b3f805a7e6a6ffe3732a50e8c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 8 Sep 2023 14:46:50 +0000 Subject: [PATCH] Bug 34745: FOR TESTING - ThingISBN broken: User agent blocked This patch corrects the LibraryThing URL to use https instead of http and adds a custom agent string to the initialization of LWP::UserAgent: "Mozilla/5.0" This is a test to confirm that the a different user agent string might allow the ThingISBN to work again. --- C4/XISBN.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/XISBN.pm b/C4/XISBN.pm index 67d89ea96c..476c146a00 100644 --- a/C4/XISBN.pm +++ b/C4/XISBN.pm @@ -84,7 +84,7 @@ sub get_xisbns { my ($response,$thing_response,$syndetics_response,$errors); # THINGISBN if ( C4::Context->preference('ThingISBN') ) { - my $url = "http://www.librarything.com/api/thingISBN/".$isbn; + my $url = "https://www.librarything.com/api/thingISBN/".$isbn; $thing_response = _get_url($url,'thingisbn'); } @@ -120,8 +120,9 @@ sub get_xisbns { sub _get_url { my ($url,$service_type) = @_; my $ua = LWP::UserAgent->new( - timeout => 2 - ); + timeout => 2, + agent => "Mozilla/5.0" + ); my $response = $ua->get($url); if ($response->is_success) { -- 2.30.2