MCPcopy
hub / github.com/petertodd/python-bitcoinlib / _get_response

Method _get_response

bitcoin/rpc.py:277–291  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

275 return self._get_response()
276
277 def _get_response(self):
278 http_response = self.__conn.getresponse()
279 if http_response is None:
280 raise JSONRPCError({
281 'code': -342, 'message': 'missing HTTP response from server'})
282
283 rdata = http_response.read().decode('utf8')
284 try:
285 return json.loads(rdata, parse_float=decimal.Decimal)
286 except Exception:
287 raise JSONRPCError({
288 'code': -342,
289 'message': ('non-JSON HTTP response with \'%i %s\' from server: \'%.20s%s\''
290 % (http_response.status, http_response.reason,
291 rdata, '...' if len(rdata) > 20 else ''))})
292
293 def close(self):
294 if self.__conn is not None:

Callers 2

_callMethod · 0.95
_batchMethod · 0.95

Calls 1

JSONRPCErrorClass · 0.85

Tested by

no test coverage detected