Unverified Commit 520e11a2 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Add PKP support

Requires "probably Polish" IP address that is allowed at the PKP endpoint

When using new_p or providing a ua object, the user agent string must be set to
'Dalvik/2.1.0'.
parent dc87974a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@ sub new {

	if ( not $ua ) {
		my %lwp_options = %{ $conf{lwp_options} // { timeout => 10 } };
		if ( $service and $hafas_instance->{$service}{ua_string} ) {
			$lwp_options{agent} = $hafas_instance->{$service}{ua_string};
		}
		$ua = LWP::UserAgent->new(%lwp_options);
		$ua->env_proxy;
	}
+9 −4
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ sub load_instance {
	if ( $opt{lang} ) {
		$ret{request}{lang} = $opt{lang};
	}
	if ( $opt{ua_string} ) {
		$ret{ua_string} = $opt{ua_string};
	}
	if ( $opt{ver} ) {
		$ret{request}{ver} = $opt{ver};
	}
@@ -179,6 +182,8 @@ my %hafas_instance = (
		),
		stopfinder => 'https://fahrplan.oebb.at/bin/ajax-getstop.exe',
	},
	PKP =>
	  { load_instance( 'pl/pkp', lang => 'pol' ), ua_string => 'Dalvik/2.1.0' },
	Resrobot => { load_instance( 'se/resrobot',  lang => 'sve' ), },
	RMV      => { load_instance( 'de/rmv',       lang => 'deu' ), },
	RSAG     => { load_instance( 'de/rsag',      lang => 'deu' ), },