Re: Can Clojure be as readable as Python or Ruby ?

2012-03-08 Thread djh
I think it's all down to pattern recognition. 

Once you've been developing in Clojure for a while you start to recognise 
patterns very easily, meaning reading other peoples code isn't really an 
issue.

The same applies to languages like Haskell, when you're just starting out 
it might seem a little alien, but after a while you start to recognise 
things and "read" the code a lot quicker

On Wednesday, March 7, 2012 5:39:08 PM UTC, Leon Talbot wrote:
>
> If so, how ? 
>
> Thanks !


On Wednesday, March 7, 2012 5:39:08 PM UTC, Leon Talbot wrote:
>
> If so, how ? 
>
> Thanks !

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: clj-http - how to use cookies in subsequent request

2012-01-02 Thread djh
Excellent thanks Stephen that's done the trick, I've been pulling my
hair out over this!


On Jan 1, 9:40 pm, Stephen Compall  wrote:
> On Sun, 2012-01-01 at 08:11 -0800, djh wrote:
> > How do I use this response as part of any subsequent requests? The
> > response contains a 302 code which I'd imagine should redirect to the
> > homepage as a logged in user, but I'm struggling to understand how to
> > make clj-http use the authenticated cookie as part of new requests.
>
> I think you can just pass {:cookies ...} with the same value from the
> response back in with the second request, based on a reading of the
> code.
>
> However, if you're willing to cut out the middleman and go
> non-functional, a single DefaultHttpClient from Apache
> httpcomponents-client can hold on to a stateful cookie jar for multiple
> requests.
>
> --
> Stephen Compall
> ^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


clj-http - how to use cookies in subsequent request

2012-01-01 Thread djh
I'm really struggling with this one. Basically I'm trying to login to
reddit programmatically (I know i know there's an API but just for the
purposes of this) and I figured the http library would be the best way
to do this.

So, using the following code

(post "https://ssl.reddit.com/post/login"; {:form-params { :user "" :passwd ""}})
=> {:cookies {"reddit_session" {:discard true, :domain
"reddit.com", :path "/", :value..}

How do I use this response as part of any subsequent requests? The
response contains a 302 code which I'd imagine should redirect to the
homepage as a logged in user, but I'm struggling to understand how to
make clj-http use the authenticated cookie as part of new requests.

I was looking at this library: -

https://github.com/technomancy/clojure-http-client

Which uses the following example: -

(res/with-cookies {}
  (res/post "http://localhost:3000/login"; {} {"user" user "password"
password})
  (res/get "http://localhost:3000/my-secret-page))

Are there any ways of using clj-http to do something similar?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en