Created
November 26, 2009 02:26
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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