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

How do you prefer to have proxy support? #2

Closed
miguelff opened this issue Jul 15, 2012 · 1 comment
Closed

How do you prefer to have proxy support? #2

miguelff opened this issue Jul 15, 2012 · 1 comment

Comments

@miguelff
Copy link

Hi TJ,

I've checked out your gem because I need to create a toy metasearch engine, the thing is that I need to have proxy support to pass through my university network, and I was about to create a patch.

As you already know, adding proxy support is trivial but, in order to keep the excellent usability of the API I was wondering which one of the following approaches would you prefer me to follow:

  • On the one side, I can keep the stateless, self-containing style of the queries and do what's necessary to allow something like this:
Google::Search::Web.new(:query => 'naked celebrities',  :proxy => 'http://proxy.uniovi.es:8888').each do |web_result|
   #... Whatever
 end
  • On the other side, it could be interesting to have a means of configuring a proxy for all the queries, as it is very likely that someone needing a proxy to submit a query, would need it to submit all of them:
Google::Search::Defaults.set(:proxy, 'http://proxy.uniovi.es:8888')
Google::Search::Web.new(:query => 'naked celebrities').each{ | web_result | ... }
Google::Search::Images.new(:query => 'angelina jolie').each{ | image | ... }
Google::Search::Local.new(:query => 'foo bar').each{ |place| ... }

Both alternatives can be complementary.

Do you think that having a Defaults object would break your API orthogonality? having it would ease the case of needing a proxy, which IMHO is not that uncommon, but I would like to know your opinion.

Regards,

Miguel

@sevk
Copy link

sevk commented Dec 31, 2015

I need proxy too , thank you .

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

No branches or pull requests

2 participants