Class: Mechanize::HTTP::Agent
- Inherits:
-
Object
- Object
- Mechanize::HTTP::Agent
- Defined in:
- lib/socksify_mechanize.rb
Overview
agent = Mechanize.new agent.agent.set_socks(‘localhost’, 9050) #Use Tor as proxy
Instance Method Summary collapse
Instance Method Details
#set_socks(addr, port) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/socksify_mechanize.rb', line 10 def set_socks(addr, port) set_http unless @http class << @http attr_accessor :socks_addr, :socks_port def http_class Net::HTTP.SOCKSProxy(socks_addr, socks_port) end end @http.socks_addr = addr @http.socks_port = port end |