Loading Build.PL +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ Module::Build->new( 'List::Util' => 0, 'LWP::UserAgent' => 0, 'LWP::Protocol::https' => 0, 'UUID' => 0, }, script_files => 'bin/', sign => 1, Loading lib/Travel/Status/DE/DBRIS.pm +13 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use DateTime::Format::Strptime; use Encode qw(decode encode); use JSON; use LWP::UserAgent; use UUID qw(uuid4); use Travel::Status::DE::DBRIS::Formation; use Travel::Status::DE::DBRIS::JourneyAtStop; Loading Loading @@ -42,6 +43,13 @@ sub new { results => [], station => $conf{station}, ua => $ua, header => { 'accept' => 'application/json', 'content-type' => 'application/json; charset=utf-8', 'Origin' => 'https://www.bahn.de', 'Referer' => 'https://www.bahn.de/buchung/fahrplan/suche', 'x-correlation-id' => uuid4() . '_' . uuid4(), }, }; bless( $self, $obj ); Loading Loading @@ -137,6 +145,10 @@ sub new { say "requesting $req"; } while ( my ( $key, $value ) = each %{ $self->{header} } ) { $ua->default_header( $key => $value ); } my ( $content, $error ) = $self->get_with_cache($req); if ($error) { Loading Loading @@ -317,7 +329,7 @@ sub get_with_cache_p { say ' cache miss'; } $self->{ua}->get_p($url)->then( $self->{ua}->get_p( $url => $self->{header} )->then( sub { my ($tx) = @_; if ( my $err = $tx->error ) { Loading Loading
Build.PL +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ Module::Build->new( 'List::Util' => 0, 'LWP::UserAgent' => 0, 'LWP::Protocol::https' => 0, 'UUID' => 0, }, script_files => 'bin/', sign => 1, Loading
lib/Travel/Status/DE/DBRIS.pm +13 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use DateTime::Format::Strptime; use Encode qw(decode encode); use JSON; use LWP::UserAgent; use UUID qw(uuid4); use Travel::Status::DE::DBRIS::Formation; use Travel::Status::DE::DBRIS::JourneyAtStop; Loading Loading @@ -42,6 +43,13 @@ sub new { results => [], station => $conf{station}, ua => $ua, header => { 'accept' => 'application/json', 'content-type' => 'application/json; charset=utf-8', 'Origin' => 'https://www.bahn.de', 'Referer' => 'https://www.bahn.de/buchung/fahrplan/suche', 'x-correlation-id' => uuid4() . '_' . uuid4(), }, }; bless( $self, $obj ); Loading Loading @@ -137,6 +145,10 @@ sub new { say "requesting $req"; } while ( my ( $key, $value ) = each %{ $self->{header} } ) { $ua->default_header( $key => $value ); } my ( $content, $error ) = $self->get_with_cache($req); if ($error) { Loading Loading @@ -317,7 +329,7 @@ sub get_with_cache_p { say ' cache miss'; } $self->{ua}->get_p($url)->then( $self->{ua}->get_p( $url => $self->{header} )->then( sub { my ($tx) = @_; if ( my $err = $tx->error ) { Loading