wikibot 0.2.4.2 → 0.2.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,7 @@ module WikiBot
38
38
  c.headers["User-Agent"] = self.user_agent
39
39
  c.headers["Accept-Encoding"] = "gzip" # Request gzip-encoded content from MediaWiki
40
40
  c.follow_location = true if @follow_redirects
41
+ c.ssl_verify_peer = false
41
42
  end
42
43
 
43
44
  login if auto_login
@@ -52,7 +53,9 @@ module WikiBot
52
53
  "#{@config.username}/#{self.version} WikiBot/#{WikiBot::VERSION} (https://github.com/dvandersluis/wikibot)"
53
54
  end
54
55
 
55
- def query_api(method, raw_data = {})
56
+ def query_api(method, raw_data = {}, dry_run = false)
57
+ return false if dry_run
58
+
56
59
  # Send a query to the API and handle the response
57
60
  url = @config.api
58
61
  raw_data = raw_data.to_openhash
@@ -128,7 +128,6 @@ module WikiBot
128
128
 
129
129
  def write(text, summary, section = nil, minor = false)
130
130
  return false unless @wiki_bot.logged_in?
131
- return false unless writable?
132
131
 
133
132
  data = {
134
133
  :action => :edit,
@@ -145,10 +144,13 @@ module WikiBot
145
144
  data[:minor] = 1 if minor
146
145
  data[:notminor] = 1 if !minor
147
146
 
148
- result = @wiki_bot.query_api(:post, data)
149
- status = result.edit.result
150
- @wiki_bot.page_writes += 1
151
- raise WriteError, status unless status == "Success"
147
+ result = @wiki_bot.query_api(:post, data, !writable?)
148
+
149
+ if writable?
150
+ status = result.edit.result
151
+ @wiki_bot.page_writes += 1
152
+ raise WriteError, status unless status == "Success"
153
+ end
152
154
 
153
155
  true
154
156
  end
@@ -1,3 +1,3 @@
1
1
  module WikiBot
2
- VERSION = "0.2.4.2"
2
+ VERSION = "0.2.4.3"
3
3
  end
@@ -1,8 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ require 'lib/wikibot/version'
2
3
 
3
4
  Gem::Specification.new do |s|
4
5
  s.name = %q{wikibot}
5
- s.version = "0.2.4.2"
6
+ s.version = WikiBot::VERSION
6
7
 
7
8
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
9
  s.authors = ["Daniel Vandersluis"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikibot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 75
4
+ hash: 73
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
9
  - 4
10
- - 2
11
- version: 0.2.4.2
10
+ - 3
11
+ version: 0.2.4.3
12
12
  platform: ruby
13
13
  authors:
14
14
  - Daniel Vandersluis