rwikibot 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/lib/rwikibot.rb +21 -4
- data/test/rwikibot.log +3 -0
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
RWikiBot ChangeLog
|
2
2
|
|
3
|
+
1.0.6
|
4
|
+
- Added VERSION
|
5
|
+
- Removed some _more_ debugging code
|
6
|
+
- Fixed login code to send back tokens and things, thereby fixing login altogether. Bots are now welcome!
|
7
|
+
|
3
8
|
1.0.5
|
4
9
|
- Added parameters for queries to the rdoc - save MediaWiki some bandwidth
|
5
10
|
- Added BACKLINKS, PAGE_EXISTS?, EMBEDDED_IN, IMAGE_EMBEDDED_IN
|
data/lib/rwikibot.rb
CHANGED
@@ -285,7 +285,7 @@ class RWikiBot
|
|
285
285
|
|
286
286
|
# This will get all pages. Limits vary based on user rights of the Bot. Set to bot.
|
287
287
|
@wikibotlogger.debug "ALL PAGES - Preparing request information..."
|
288
|
-
post_me = {'list' => 'allpages', 'apnamespace' => '0', 'aplimit' => '
|
288
|
+
post_me = {'list' => 'allpages', 'apnamespace' => '0', 'aplimit' => '5000'}
|
289
289
|
|
290
290
|
|
291
291
|
if options != nil
|
@@ -539,6 +539,12 @@ class RWikiBot
|
|
539
539
|
@wikibotlogger.debug "PAGE EXISTS? - Preparing request information..."
|
540
540
|
post_me = {'titles' => title}
|
541
541
|
|
542
|
+
if @config.fetch('logged_in')
|
543
|
+
post_me['lgusername'] = @config.fetch('lgusername')
|
544
|
+
post_me['lguserid'] = @config.fetch('lguserid')
|
545
|
+
post_me['lgtoken'] = @config.fetch('lgtoken')
|
546
|
+
end
|
547
|
+
|
542
548
|
#Make the request
|
543
549
|
@wikibotlogger.debug "PAGE EXISTS? - Asking make_request to verify page existence..."
|
544
550
|
page_exists_result = make_request('query', post_me)
|
@@ -557,6 +563,16 @@ class RWikiBot
|
|
557
563
|
|
558
564
|
end
|
559
565
|
|
566
|
+
# This method will return the version of the MediaWiki server. This is done by parsing the version number from the generator attribute of the the site_info method. Useful? Yes - maybe yout bot is only compatible with MediaWiki 1.9.0 depending on what methods you use. I like it, anwyay.
|
567
|
+
#
|
568
|
+
# INPUT:: None
|
569
|
+
#
|
570
|
+
# OUTPUT:: Version number
|
571
|
+
def version
|
572
|
+
# Almost TOO simple...
|
573
|
+
return site_info.fetch('generator').split(' ')[1]
|
574
|
+
end
|
575
|
+
|
560
576
|
private
|
561
577
|
|
562
578
|
# Make Request is a method that actually handles making the request to the API. Since the API is somewhat standardized, this method is able to accept the action and a hash of variables, and it handles all the fun things MediaWiki likes to be weird over, like cookies and limits and actions. Its very solid, but I didn't want it public because it also does some post processing, and that's not very OO.
|
@@ -584,9 +600,10 @@ class RWikiBot
|
|
584
600
|
|
585
601
|
#Send the actual request
|
586
602
|
@wikibotlogger.debug "MAKE REQUEST - Sending request..."
|
587
|
-
|
588
|
-
@
|
589
|
-
@wikibotlogger.
|
603
|
+
#'User-agent' => 'RWikiBot/0.1'
|
604
|
+
resp = @http.post( @config.fetch('uri').path , post_string , {'User-agent'=>'RWikiBot/1.0', 'Cookie' => bake(@config.fetch('cookie')) } ) #
|
605
|
+
@wikibotlogger.debug "MAKE REQUEST - Response: "
|
606
|
+
@wikibotlogger.debug resp.body
|
590
607
|
@wikibotlogger.debug "MAKE REQUEST - End Response "
|
591
608
|
result = YAML.load(resp.body)
|
592
609
|
|
data/test/rwikibot.log
ADDED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rwikibot
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-03-
|
6
|
+
version: 1.0.6
|
7
|
+
date: 2007-03-08 00:00:00 -06:00
|
8
8
|
summary: A library for creating MediaWiki bots.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -29,6 +29,7 @@ authors:
|
|
29
29
|
- Eddie Roger
|
30
30
|
files:
|
31
31
|
- lib/rwikibot.rb
|
32
|
+
- test/rwikibot.log
|
32
33
|
- sample-config.yaml
|
33
34
|
- README
|
34
35
|
- CHANGELOG
|