Mechanize on HTTPS website

Has anyone used a Mechanize stone on a site that required SSL?

When I try to access such a site, Mechanize tries to use standard HTTP, which leads to endless redirects between http: // and https: //.

+3
source share
2 answers

The mechanism works great with HTTPS. Try to install

agent.log = Logger.new(STDOUT)

to find out what happens between Mechanize and the server. If you still have problems, send a sample code and someone will help.

+3
source

Mechanize - . - HTTP, " ", HTTPS. . :

#!/usr/bin/ruby1.8

require 'rubygems'
require 'mechanize'

agent = WWW::Mechanize.new
page = agent.get("http://www.not_the_real_url.com")
link = page.link_with(:text=>"CUSTOMER LOGIN")
page = link.click
form = page.forms.first
form['user_login'] = 'not my real login name'
form['user_password'] = 'not my real password'
page = form.submit
0

Source: https://habr.com/ru/post/1728303/


All Articles