clojure oauth和凭据
我需要一些帮助 我在最后一步被卡住了:用凭据签署请求clojure oauth和凭据,oauth,clojure,flickr,Oauth,Clojure,Flickr,我需要一些帮助 我在最后一步被卡住了:用凭据签署请求 (def credentials (oauth/credentials consumer (:oauth_token access-token-response) (:oauth_token_secret access-token-response)
(def credentials (oauth/credentials consumer
(:oauth_token access-token-response)
(:oauth_token_secret access-token-response)
:POST
"http://twitter.com/statuses/update.json"
{:status "posting from #clojure with #oauth"}))
(http/put "http://twitter.com/statuses/update.json"
:query-params credentials)
这就是github的例子
现在,通过flickr API,我得到了以下测试url:
http://api.flickr.com/services/rest/?method=flickr.people.getPhotos
&api_key=82d4d4ac421a5a22et4b49a04332c3ff
&user_id=93029506%40N07&format=json&nojsoncallback=1
&auth_token=72153452760816580-cd1e8e4ea15733c3
&api_sig=b775474e44e403a79ec2a58d771e2022
我不使用推特。。。我使用FlickrAPI并希望获得用户的图片
我现在的问题是:如何更改符合flickr url的凭据?
我也对
:status
感到困惑,但当我删除它时,我得到一个错误…Twitter示例使用HTTP POST方法,但对于Flickr,我们需要获取和Flickr api。我们也是
(def credentials (oauth/credentials consumer
(:oauth_token access-token-response)
(:oauth_token_secret access-token-response)
:GET
"http://api.flickr.com/services/rest/"
query-params))
在twitter示例中,我用queryparams
替换的内容指定了发布的内容。信息技术
是一个将url编码为以下内容的映射:status=posting%20从%20%23clojure%20到%20%23oauth
。相反,您提到的API的请求具有以下非oauth查询参数映射:
(def query-params {:method "flickr.people.getPhotos" :format "json" :user_id "93029506@N07" :nojsoncallback 1})
现在我们要做的就是
(http/get "http://api.flickr.com/services/rest/" {:query-params (merge credentials query-params)})
那把api_钥匙应该是秘密的吗?82d4…?它只是一个测试密钥,几个小时后就会过期。。。但是我现在改了号码。。。也许更安全;)如果你给出真实的代码(sans键)而不是twitter示例,这将是非常有帮助的。FWIW,这里有一个也使用这个库的存储库(尽管也是twitter):嘿,我知道你说过你想使用一个使用clj oauth的解决方案,Flickr使用oauth 1,但我刚刚写了一个关于使用LinkedIn API(oauth 2)的条目没有任何oauth框架,我相信它可能有用(以防万一,整个oauth和104行Clojure中的一个查询)。链接:和回购: