summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-10-02 21:52:29 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-10-02 21:52:29 +0200
commit464b6b1583c0a5fa3bf38a9711bce9f200a22378 (patch)
treed5943df5aa222e95ebc0cf89ca890cd7071598ba
parent5d35f32a3c6da3359ee33810fd08a077f63bb0ea (diff)
NAHSH: Switch to mgate
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index 56a79b3..3a90353 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -53,10 +53,23 @@ my %hafas_instance = (
},
},
NAHSH => {
- url => 'https://nah.sh.hafas.de/bin/stboard.exe',
+ mgate => 'https://nah.sh.hafas.de/bin/mgate.exe',
stopfinder => 'https://nah.sh.hafas.de/bin/ajax-getstop.exe',
name => 'Nahverkehrsverbund Schleswig-Holstein',
productbits => [qw[ice ice ice regio s bus ferry u tram ondemand]],
+ request => {
+ client => {
+ id => 'NAHSH',
+ v => '3000700',
+ type => 'IPH',
+ name => 'NAHSHPROD',
+ },
+ ver => '1.16',
+ auth => {
+ type => 'AID',
+ aid => 'r0Ot9FLF' . 'NAFxijLW'
+ },
+ },
},
NASA => {
url => 'https://reiseauskunft.insa.de/bin/stboard.exe',
@@ -393,7 +406,9 @@ sub check_mgate {
$self->{errstr} = 'error code is ' . $self->{raw_json}{err};
$self->{errcode} = $self->{raw_json}{err};
}
- elsif ( $self->{raw_json}{cInfo}{code} ne 'OK' ) {
+ elsif ( defined $self->{raw_json}{cInfo}{code}
+ and $self->{raw_json}{cInfo}{code} ne 'OK' )
+ {
$self->{errstr} = 'cInfo code is ' . $self->{raw_json}{cInfo}{code};
$self->{errcode} = $self->{raw_json}{cInfo}{code};
}