recommended HTTP client?

In the past I have used Net::HTTP to call trivial remote services.
These calls have been low frequency so didn't bother looking into
alternatives.

I'm now looking at a design where I will be calling a remote service
that returns a simple CSV but it will be called frequently and if that
service goes down I need to degrade gracefully. I'd like to punt if
the web service fails to respond in 1 second (500 ms may be better).

Is there a library that makes this simple. Seems like some hackery is
needed to make this happen with Net::HTTP
ex: http://groups.google.com/group/chicagoruby/browse_thread/thread/8b8aadc26545e165

It seems like there are 100s of ruby http libraries out there.

Tony

Tony Primerano wrote in post #972234:

In the past I have used Net::HTTP to call trivial remote services.
These calls have been low frequency so didn't bother looking into
alternatives.

I'm now looking at a design where I will be calling a remote service
that returns a simple CSV but it will be called frequently and if that
service goes down I need to degrade gracefully. I'd like to punt if
the web service fails to respond in 1 second (500 ms may be better).

Is there a library that makes this simple. Seems like some hackery is
needed to make this happen with Net::HTTP
ex:
http://groups.google.com/group/chicagoruby/browse_thread/thread/8b8aadc26545e165

It seems like there are 100s of ruby http libraries out there.

Would HTTParty have what you need?

Tony

Best,

It looks like HTTParty uses Net::HTTP so I'll just stick with that.

I got burned by so many deprecated gems moving from Rails 2 to Rails 3
that use them sparingly now. :-\

Please quote when replying.

Tony Primerano wrote in post #972913:

It looks like HTTParty uses Net::HTTP so I'll just stick with that.

Stick with *which*?

I got burned by so many deprecated gems moving from Rails 2 to Rails 3
that use them sparingly now. :-\

I see this attitude a lot, and I believe it is silly. If there's
already a library out there that makes your life easier, don't reinvent
the wheel. Laziness is one of the cardinal virtues for programmers!

Best,

Please quote when replying.

Tony Primerano wrote in post #972913:

> It looks like HTTParty uses Net::HTTP so I'll just stick with that.

Stick with *which*?

I'll just call Net::HTTP directly. I have a simple GET request that
returns some simple CSV data.

> I got burned by so many deprecated gems moving from Rails 2 to Rails 3
> that use them sparingly now. :-\

I see this attitude a lot, and I believe it is silly. If there's
already a library out there that makes your life easier, don't reinvent
the wheel. Laziness is one of the cardinal virtues for programmers!

I'm not really reinventing the wheel here. HTTParty is fine but I
just wanted a connection timeout via Net::HTTP, which I learned how to
do by looking at HTTParty code.

If a 1000 line gem is saving me 10 lines of code I'm better off not
using it.

Gems like authlogic are essential. If I needed more HTTParty features
I would use it but for now the standard library is just fine. :slight_smile:

Tony Primerano wrote in post #972944:
[...]

If a 1000 line gem is saving me 10 lines of code I'm better off not
using it.

Not necessarily true. *You* didn't have to write the 1000 lines, and
you didn't have to write the extra 10 lines. Where's the downside?

(I'm not saying you should put random crap into your application, but
sometimes a library really is the simplest solution.)

Gems like authlogic are essential. If I needed more HTTParty features
I would use it but for now the standard library is just fine. :slight_smile:

Best,

Writing 10 lines of code takes a couple minutes, depending on a gem is forever.

Greg Donald wrote in post #972952:

Not necessarily true. *You* didn't have to write the 1000 lines, and
you didn't have to write the extra 10 lines. Where's the downside?

Writing 10 lines of code takes a couple minutes,

And installing a gem takes 30 seconds. (In this case, I'd probably
write the 10 lines, but not if the numbers were a little different.)

depending on a gem is
forever.

No it's not, unless your tests are that bad.

Best,

Depending on a gem or not has not a fucking thing to do with tests.

I'm adding you to my kill file, you have proven time and again you are
an utter moron.

Greg Donald wrote in post #972968:

depending on a gem is
forever.

No it's not, unless your tests are that bad.

Depending on a gem or not has not a f*cking thing to do with tests.

I'm adding you to my kill file, you have proven time and again you are
an utter moron.

If that means I no longer have to put up with your misinformed sniping,
then good riddance. The list will be a happier place.

--
Greg Donald
destiney.com | gregdonald.com

Best,