Hi,
I installed the MediaWiki::API (version 0.30) module from CPAN onto my
linux workstation. The wiki site that I wish to connect and modify is
running WikiMedia over https and I cannot get this simple login script
to work:
#!/usr/bin/perl
use strict;
use warnings;
use MediaWiki::API;
my $mw = MediaWiki::API->new();
sub on_error()
{
print "Error code: " . $mw->{error}->{code} . "\n";
print $mw->{error}->{stacktrace}."\n";
die;
}
$mw->{config}->{api_url} = 'https://wiki.eng.somecompany.com/index.php';
$mw->{config}->{on_error} = \&on_error;
# log in to the wiki
$mw->login( { lgname => 'myuser', lgpassword => 'mypass'} );
use Data::Dumper;
print Dumper($mw);
# perl wiki.pl
Error code: 2
401 Authorization Required : error occurred when accessing
https://wiki.eng.somecompany.com/index.php after 1 attempt(s) at
/usr/local/lib/perl5/site_perl/5.10.0/MediaWiki/API.pm line 354
MediaWiki::API::api('MediaWiki::API=HASH(0xce6e88)',
'HASH(0xf64ad0)') called at
/usr/local/lib/perl5/site_perl/5.10.0/MediaWiki/API.pm line 218
MediaWiki::API::login('MediaWiki::API=HASH(0xce6e88)',
'HASH(0xf64ad0)') called at wiki.pl line 19
Died at wiki.pl line 12.
From the documentation, error code 2 stands for
ERR_HTTP and I believe
this is due to attempting a connection over https.
Has anyone on the list had success with using the API (with
perl/python/java etc..) to login to wikis running https? Any pointers
to examples will be greatly helpful.
Thanks,
ravi