3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Plugins: Weather and Wttr now use LWPUserAgentCached

This commit is contained in:
Pragmatic Software 2020-01-30 21:17:58 -08:00
parent 609523fd67
commit 96fbf4c420
2 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ use strict;
use feature 'unicode_strings';
use LWP::UserAgent::WithCache;
use PBot::Utils::LWPUserAgentCached;
use XML::LibXML;
use Getopt::Long qw(GetOptionsFromString);
use Carp ();
@ -83,7 +83,7 @@ sub get_weather {
'default_expires_in' => 3600
);
my $ua = LWP::UserAgent::WithCache->new(\%cache_opt, timeout => 10);
my $ua = PBot::Utils::LWPUserAgentCached->new(\%cache_opt, timeout => 10);
my $response = $ua->get("http://rss.accuweather.com/rss/liveweather_rss.asp?metric=0&locCode=$location");
my $xml;

View File

@ -18,7 +18,7 @@ use utf8;
use feature 'switch';
no if $] >= 5.018, warnings => "experimental::smartmatch";
use LWP::UserAgent::WithCache;
use PBot::Utils::LWPUserAgentCached;
use JSON;
use Getopt::Long qw(GetOptionsFromString);
use URI::Escape qw/uri_escape_utf8/;
@ -121,7 +121,7 @@ sub get_wttr {
my $location_uri = uri_escape_utf8 $location;
my $ua = LWP::UserAgent::WithCache->new(\%cache_opt, timeout => 10);
my $ua = PBot::Utils::LWPUserAgentCached->new(\%cache_opt, timeout => 10);
my $response = $ua->get("http://wttr.in/$location_uri?format=j1&m");
my $json;