Created
April 11, 2013 09:11
-
-
Save psihy/5361907 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;; gauche 0.9.3.3 | |
;; ref. http://developer.hatenastaff.com/entry/2013/04/11/143235 | |
(use rfc.json) | |
(use rfc.http) | |
(use rfc.uri) | |
(define (api-request uri) | |
(receive (scheme user-info hostname port path query fragment) (uri-parse uri) | |
(receive (status header body) (http-get hostname path) | |
(cond ((< (string->number status) 400) (parse-json-string body)) | |
(else (error status)))))) | |
(let ((user (api-request "http://ugomemo.hatena.ne.jp/[email protected]")) | |
(movies (api-request "http://ugomemo.hatena.ne.jp/11F9E990AA34FFBC@DSi/movies.json"))) | |
(print (assoc-ref user "name") "さんは" (assoc-ref movies "count") "個の作品を投稿しています")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment