Catching timeout errors with ruby mechanize

前端 未结 2 798
忘掉有多难
忘掉有多难 2021-01-02 08:27

I have a mechanize function to log me out of a site but on very rare occasions it times me out. The function involves going to a specific page, and then clicking on a logout

2条回答
  •  伪装坚强ぢ
    2021-01-02 09:01

    Using mechanize 1.0.0 I got this problem from a different source of error.

    In my case I was blocked by proxy and then SSL. This worked for me:

    ag = Mechanize.new
    ag.set_proxy('yourproxy', yourport)
    ag.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    ag.get( url )
    

提交回复
热议问题