Has the Treasury Direct interface changed?

John Ralls jralls at ceridwen.us
Thu Dec 28 17:14:59 EST 2017



> On Dec 28, 2017, at 1:56 PM, farleykj <farleykj at gmail.com> wrote:
> 
> Sorry, I thought I'd responded to the message about telling the agent what
> browser it is identifying itself as.
> I'm using Perl, and the code I'm using to see what's up is as follows:
> 
> <BEGIN CODE>
> use LWP::UserAgent ;
> use LWP::Simple ;
> 
> my $urlSite  = "https://www.treasurydirect.gov/BC/SBCPrice" ;
> my $idBrowser = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0)
> Gecko/20100101 Firefox/57.0" ;
> 
> my $userAgent = LWP::UserAgent->new ;
> $userAgent->agent ( $idBrowser ) ;
> 
> my $resData = $userAgent->get ( $urlSite ) ;
> print "--- [ CONTENT ] --- \n" ;
> print $resData->content . "\n" ;
> print "--- [ CONTENT ] --- \n" ;
> <END CODE>
> 
> The output I get from this is as follows:
> 
> --- [ CONTENT ] --- 
> Can't connect to www.treasurydirect.gov:443 (Connection refused)
> 
> LWP::Protocol::https::Socket: connect: Connection refused at
> /Library/Perl/5.18/LWP/Protocol/http.pm line 49.
> 
> --- [ CONTENT ] --- 
> 
> It's not like I'm some expert in Perl, but I have been using the module I
> wrote for a couple of years. It was working fine until somewhere around the
> middle of this month, then suddenly failed. Attempting to debug things shows
> that even the simplest attempts to communicate with the site don't get me
> anything but the above error message.
> 

It's not your script or treasurydirect.gov. When I run your script I get:

--- [ CONTENT ] ---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

	<title>Calculate the Value of Your Paper Savings Bond(s)</title>
	<meta name="BPD.source" content="BC_savings_start.tpl" />
	<style type="text/css" media="all"> @import "/css/bc_all.css"; </style>

	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<link type="text/css" rel="stylesheet" media="screen" href="/css/gw_td_null.css" />
	<style type="text/css" media="screen"> @import "/css/gw_indiv_screen.css"; </style>
	<style type="text/css" media="print"> @import "/css/gw_indiv_print.css"; </style>
	<link type="text/css" rel="stylesheet" media="all" href="/css/gw_td_fontsize76.css" title="76" />

[************************* A lot of output removed for brevity ******************************]
</div>

</body>
</html>

--- [ CONTENT ] ---

So the problem would seem to be between you and them.

Regards,
John Ralls




More information about the gnucash-user mailing list