LP#1666987: Include a user-agent to build the relator map user/dbs/lp1666987_build_relator_map_ua
authorDan Scott <dscott@laurentian.ca>
Sun, 13 May 2018 14:59:24 +0000 (10:59 -0400)
committerDan Scott <dscott@laurentian.ca>
Sun, 13 May 2018 14:59:24 +0000 (10:59 -0400)
loc.gov started using Cloudflare protection to block HTTP access from default
user agents, so identify ourselves as an Evergreen user agent to restore our
access.

Long term we should evolve to using the linked open data access method
via id.loc.gov but let's get this working first.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
build/tools/relator_map

index 7423482..dc949b1 100755 (executable)
@@ -4,9 +4,12 @@ use warnings;
 
 use XML::LibXML;
 use XML::LibXML::Reader;
-use LWP::Simple;
+use LWP::Simple qw($ua get);
 use Data::Dumper;
 
+# loc.gov blocks basic user agents now
+$ua->agent('Evergreen/3.1');
+
 my %relator;
 my $code = 0;
 my $fullname = 0;