On Sat, Jun 5, 2010 at 9:07 AM, Mike.lifeguard mike.lifeguard@gmail.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 10-06-05 12:53 PM, Ravi Parimi wrote:
I installed the MediaWiki::API (version 0.30) module from CPAN
MediaWiki::Bot provides another layer of convenience, you might want to use that. It'll handle logging in for you automatically, for example.
You can use 2.3.1, but note that the 3.0 release of MediaWiki::Bot is about to come out in just a few days, and it introduces breaking changes.
I'll be making an actual announcement on a few mailing lists, including this one, when it becomes available in CPAN.
Mike,
Thanks much for the pointer to MediaWiki::Bot. I came up with the following script but it seems to hang right during $bot->login():
# cat -n bot.pl
1 #!/usr/bin/perl 2 use strict; 3 use warnings; 4 use MediaWiki::Bot; 5 my $bot = MediaWiki::Bot->new( 6 useragent => 'MediaWiki::Bot 3.0.0 (User:Mike.lifeguard)', 7 assert => 'bot', 8 protocol => 'https', 9 host => 'wiki.eng.xxx.com', 10 path => 'RRDevTools', 11 ); 12 print "bot created\n"; 13 14 $bot->login( 15 { 16 # Username/password masked out 17 username => 'user', 18 password => 'passwd', 19 }, 20 ) or die "Login failed"; 21 22 print "Logged in!\n"; 23 use Data::Dumper; 24 print Dumper($bot);
# perl bot.pl bot created Error code: 2 at bot.pl line 14 500 Can't connect to https:80 (Bad hostname 'https') : error occurred when accessing http://https/host/api.php after 6 attempt(s) at bot.pl line 14
I tried setting usagent to 'MediaWiki::Bot 2.3.1 (User:Mike.lifeguard)' as well, but it didn't help. Can you spot something wrong with the above snippet? If you have any scripts that login over https, can you please point them to me?
thanks, ravi