Re: 認証、JSON RPC と Python

vessの投稿(2010年8月3日 09:02 UTC)

情報ありがとう、興味深いが、自分の問題とは違うようだ。

以下が現在のコードだ(Google App Engineで動作)

postdata = jsonrpc.dumps({“method”: ‘getbalance’, “params”:”,‘id’:‘jsonrpc’}) req = urllib2.Request(‘http://127.0.0.1:8332’, postdata) userpass = ‘user:a’.encode(‘base64’)[:-1] authheader = “Basic %s” % userpass req.add_header(“Authorization”,authheader) handle = urllib2.urlopen(req) json_response = handle.read() self.response.out.write (json_response)

これはHTTPError: HTTP Error 500: Internal Server Errorを返す。

これは bitcoin の確認済みバグだ。

bitcoin は Content-Length ヘッダーを必要とするが、いくつかの JSON-RPC ライブラリはそれを提供しない。Content-Length ヘッダーがない場合、bitcoin は 500 Internal Server Error を返す。