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 "<my
user>" :passwd "<my pass>"}})
=> {: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

Reply via email to