注意:我解决了我的问题。但是,它进行了一些增量更改。如果您碰巧出现在此页面上,请随时在下面查看我的github,以查看如何使该应用程序正常工作。
我正在使用http-kit向btc-china发布请求。我想使用他们的交易API。我可以使用python很好地完成此操作,但是由于某些原因,我不断使用clojure和http-kit获得401s。我在下面发布了一段代码,这可能表明我没有正确使用http-kit。除此之外,如果您希望查看完整的代码,请参阅github :https : //github.com/gilmaso/btc-trading这是btc-china api文档:http ://btcchina.org / api-trade-documentation-en
(def options {:timeout 2000 ; ms
:query-params (sorted-map :tonce tonce
:accesskey access-key
:requestmethod request-method
:id tonce
:method method
:params "")
:headers {"Authorization" auth-string
"Json-Rpc-Tonce" tonce}})
(client/post (str "https://" base-url) options
(fn [{:keys [status headers body error]}] ;; asynchronous handle response
(if error
(println "Failed, exception is " error)
(println "Async HTTP GET: " status))))
# The order of params is critical for calculating a correct hash
clojure哈希图是无序的,并且如果顺序很重要,则不能使用clojure哈希图文字来提供输入
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句