Method: WikiBot::Bot#initialize
- Defined in:
- lib/wikibot/core/bot.rb
#initialize(username, password, options = {}) ⇒ Bot
Returns a new instance of Bot.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/wikibot/core/bot.rb', line 17 def initialize(username, password, = {}) @cookies = OpenHash.new @api_hits = 0 @page_writes = 0 api = [:api] || "http://en.wikipedia.org/w/api.php" auto_login = [:auto_login] || false @readonly = [:readonly] || false @debug = [:debug] || false @config = { :username => username, :password => password, :api => api, :logged_in => false }.to_openhash # Set up cURL: @curl = Curl::Easy.new do |c| c.headers["User-Agent"] = self.user_agent c.headers["Accept-Encoding"] = "gzip" # Request gzip-encoded content from MediaWiki end login if auto_login end |