【发布时间】:2013-12-26 03:59:55
【问题描述】:
注意:我解决了我的问题。但是,它进行了一些增量更改。如果您遇到此页面,请随时查看我的 github,看看我是如何制作此应用程序的。
我正在使用 http-kit 向 btc-china 发布请求。我想使用他们的交易API。我可以用 python 很好地做到这一点,但由于某种原因,我一直使用 clojure 和 http-kit 得到 401。我在下面发布了一段代码,可能表明我没有正确使用 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))))
【问题讨论】:
-
您是否尝试过比较两种情况下的实际 HTTP 交换?也许看到差异会给你一个提示。
-
9000,我实际上不确定如何在 clojure 或 python 中做到这一点:/
-
像wireshark这样的程序可以让你记录http流量,并在你方便的时候进行分析