Permalink
Browse files

Adapt to new API.

  • Loading branch information...
1 parent 7c863f0 commit 603c562b1d9b6697b377dd67fe2589fd320b37d9 @neotyk neotyk committed Sep 19, 2011
Showing with 13 additions and 9 deletions.
  1. +13 −9 twitter-sample.clj
View
@@ -2,6 +2,8 @@
(:require [http.async.client :as c]
[org.danlarkin.json :as j]))
+;; Please consider using https://github.com/adamwynne/twitter-api
+
(def u "username")
(def p "password")
@@ -13,15 +15,17 @@
;; statuses/sample
(defn statuses-sample []
- (doseq [twit-str (c/string
- (c/stream-seq :get "http://stream.twitter.com/1/statuses/sample.json"
- :auth {:user u :password p}))]
- (print-user-and-text "sample" twit-str)))
+ (with-open [client (c/create-client)]
+ (doseq [twit-str (c/string
+ (c/stream-seq client :get "http://stream.twitter.com/1/statuses/sample.json"
+ :auth {:user u :password p}))]
+ (print-user-and-text "sample" twit-str))))
;; statuses/filter
(defn statuses-filter []
- (doseq [twit-str (c/string
- (c/stream-seq :post "http://stream.twitter.com/1/statuses/filter.json"
- :body {"track" "basketball,football,baseball,footy,soccer"}
- :auth {:user u :password p}))]
- (print-user-and-text "sports" twit-str)))
+ (with-open [client (c/create-client)]
+ (doseq [twit-str (c/string
+ (c/stream-seq client :post "http://stream.twitter.com/1/statuses/filter.json"
+ :body {"track" "basketball,football,baseball,footy,soccer"}
+ :auth {:user u :password p}))]
+ (print-user-and-text "sports" twit-str))))

0 comments on commit 603c562

Please sign in to comment.