ビットコイン・インスティテュート

Re: 認証、​JSON RPCと​Python

vessの投稿(2010年8月3日18: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を返す。