class

Mechanize::HTTP::Agent

Inherits Reference / Object

This class handles web interation mechanize made.

Constructors

new(context : Mechanize | Nil = nil)
Source

Instance methods

add_auth(uri : String, user : String, pass : String)

set basic auth credentials.

# set an auth credential with a specific url.
agent.add_auth("http://example.com", "username", "password")
Source
auth_store
Source
authenticate_methods
Source
authenticate_parser
Source
back

returns the page mechanize previous visited.

agent.back
Source
context
Source
context=(context : Mechanize | Nil)
Source
current_page

returns the page now mechanize visiting.

agent.current_page
Source
fetch(uri, method = :get, headers = ::HTTP::Headers.new, params = Hash(String, String).new, body : String | Nil = nil, referer = (if history.empty? else current_page end))

send http request and return page. This method is called from Mechanize#get, #post and other methods. There's no need to call this method directly.

Source
history
Source
history=(history : History)
Source
max_history

Get maximum number of items allowed in the history. The default setting is 100 pages.

agent.max_history # => 100
Source
max_history=(length)

Set maximum number of items allowed in the history.

agent.max_history = 1000
Source
request_cookies
Source
request_cookies=(request_cookies : ::HTTP::Cookies)
Source
request_headers
Source
request_headers=(request_headers : ::HTTP::Headers)
Source
user_agent
Source
user_agent=(user_agent : String)
Source