Skip to content

Instantly share code, notes, and snippets.

@devn
Created November 26, 2009 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devn/243191 to your computer and use it in GitHub Desktop.
Save devn/243191 to your computer and use it in GitHub Desktop.
This is some rudimentary code to create an http connection to the twitter firehose.
(ns twitjure
(:use clojure.core)
(:use clojure.contrib.http.connection)
(:use clojure.contrib.base64)
(:use clojure.contrib.duck-streams))
(defn get-stream []
(let [conn #^java.net.HttpURLConnection
(http-connection "http://stream.twitter.com/1/statuses/sample.json")]
(.setDoInput conn true)
(.setRequestProperty conn
"Authorization"
(str "Basic " (encode-str
"USER:PASS")))
(.getInputStream conn)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment