[BACK]Return to update_json.pl CVS log [TXT][DIR] Up to [local] / HOPE / Net-OpenAMD / script

File: [local] / HOPE / Net-OpenAMD / script / update_json.pl (download)

Revision 1.1, Sat Jul 17 12:14:09 2010 UTC (13 years, 10 months ago) by andrew
Branch: MAIN
CVS Tags: HEAD

a script to get new versions of the JSON that they return

#!/usr/bin/perl
use strict;
use warnings;

use LWP::Simple;

my $uri_base  = 'http://api.hope.net/api/';
my $file_base = './t/data/';

my @paths = (
    'interests', 'location', 'speakers', 'stats', 
    'talks', 'users', 'location?user=user0',
);


foreach my $path (@paths) {
    my $uri  = $uri_base  . $path;

    $path =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
    my $file = $file_base . $path;
    
    print "mirror( $uri, $file )\n";

    my $response = mirror( $uri, $file );
    if (!is_success( $response )) {
        print "\tError: $response\n";
    }
}