Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: czaanja on June 09, 2011, 05:41:59 PM



Title: Python / twisted & bitcoin JSONRPC api
Post by: czaanja on June 09, 2011, 05:41:59 PM
Hello,

I am trying to comunnicate with the bitcoin daemon using python and twisted. But when I try to use the txjsonrpc it did not work. Here is the example:

Code:
from twisted.internet import reactor, defer
from txjsonrpc.web import jsonrpc
from txjsonrpc.jsonrpclib import Fault, VERSION_PRE1, VERSION_1, VERSION_2

proxyAuth = jsonrpc.Proxy(('user:pass@ip:port'))

dl = []
d = proxyAuth.callRemote('getinfo', version=VERSION_1)
d.addCallbacks(cbOk, cbErr)
dl.append(d)
dl = defer.DeferredList(dl)
dl.addCallback(shutDown)
reactor.run()

But from the daemon I got:

Code:
500 Internal Server Error

I also tried the jsonrpc libs mentioned in the bitcoin api documentation, which did work. But I can not use them, since i need to use the twisted deferred logic.

I was tracking the communication using wireshar and I am afraid the problem is, that twisted is using HTTP/1.0 protocol and jsonrpc is using HTTP/1.1, so the communication behaves differently. I was trying to find some solution, but I getting stuck.

Is here anyone using twisted and bitcoin API? Please can you point me to the good direction?

Thank you in advance.