--Eric Tschetter
i dunno. but, for possible cribbing, there's a Scala wrapper around
HttpClient, which supposedly makes it all Suck Less.
e.g.
There is (slurp* url) and (reader url) in clojure.contrib.duck-streams
(count (slurp* "http://google.com")) => 4675
Cheers,
Chris Dean
Dan Larkin started one a little while ago. I took it and ran with it.
http://github.com/technomancy/clojure-http-client
It consists of two different namespaces, clojure.http.client and
clojure.http.resourcefully. The client code is lower-level and works
pretty close to the underlying API, while resourcefully is higher-level
and is designed for interacting with REST-based APIs. It handles
persisting cookies and it will raise exceptions on requests that fail
rather than just giving a return code. (Still working on that last bit.)
Documentation is sparse, but I think it's pretty straightforward. It
uses the JDK's HTTPURLConnection internally. Some folks have pointed me
towards the Apache Commons HTTP Client, but I haven't seen much that it
offers over what's built-in to the JDK apart from connection pooling, so
I've been content with what I've got.
Dan has suggested that once it's better-tested and stabilized it could
be submitted to Clojure Contrib. I think that might be a good idea.
Let me know if you find it useful. I would love to get some comments.
-Phil
>> Let me know if you find it useful. I would love to get some comments.
>> -Phil
>
> Hi Phil,
>
> I'm trying out clojure-http-client, & thus far I like the idea of it
> quite a bit: a simple but clever wrapper on built-in JDK APIs, so
> provides convenience w/o the burden of external jars.
>
> Quickly, I ran into problems with the resourcefully/with-cookies
> macro. Making two changes to resourcefully.clj & altering the
> signature from the example made it work (but I didn't test too
> rigorously).
Thanks! I haven't used the cookie functionality much, as I suppose is
obvious. =)
I've committed your changes.
-Phil