Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy authentication while parsing url with Net::HTTP #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

suvarnarajkumar
Copy link

I have added code in lib/cobweb.rb for authenticating proxies. Along with this i have added a feature to rotate proxies for each request, i.e "proxy_shift" method inside the 'Cobweb' class is used for easy shifting proxies.

Example for proxy shifting:
crawler = CobwebCrawler.new({:cache => xxx, :proxy_addr => 'xxxx', :proxy_port=> 'xxxx', :proxy_uname => 'xxxx', :proxy_pwd => 'xxxxx', :internal_urls => ["xxxxxxxx"]})

action = crawler.crawl("_url_") do |content|

 # Below line changes proxies eachtime request for getting new url.
 crawler.proxy_shift({:proxy_addr => 'xxxx', :proxy_port=> 'xxxx', :proxy_uname => 'xxxx', :proxy_pwd => 'xxxx')

  # some-statements....

end

…xy username and password along with proxy details.
@stewartmckee
Copy link
Owner

Looks great, could you submit with a couple rspec specs please, and I'll get it merged in.

Thanks.

@suvarnarajkumar
Copy link
Author

Thanks for considering my code.
I will do it as soon as possible and push it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants