forked from LBRYCommunity/lbry-sdk
logging
This commit is contained in:
parent
8419e1e1d5
commit
adf89a9d1a
2 changed files with 6 additions and 4 deletions
|
@ -469,7 +469,7 @@ class DownloadRequest(RequestHelper):
|
||||||
writer, d = blob.open_for_writing(self.peer)
|
writer, d = blob.open_for_writing(self.peer)
|
||||||
if d is not None:
|
if d is not None:
|
||||||
return BlobDownloadDetails(blob, d, writer.write, writer.close, self.peer)
|
return BlobDownloadDetails(blob, d, writer.write, writer.close, self.peer)
|
||||||
log.debug('Skipping blob %s as there was an issue opening it for writing', blob)
|
log.warning('Skipping blob %s as there was an issue opening it for writing', blob)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _make_request(self, blob_details):
|
def _make_request(self, blob_details):
|
||||||
|
|
|
@ -64,8 +64,7 @@ class MarketFeed(object):
|
||||||
self.rate = ExchangeRate(self.market, price, int(time.time()))
|
self.rate = ExchangeRate(self.market, price, int(time.time()))
|
||||||
|
|
||||||
def _log_error(self, err):
|
def _log_error(self, err):
|
||||||
log.warning(
|
log.warning("There was a problem updating %s exchange rate information from %s\n%s",
|
||||||
"There was a problem updating %s exchange rate information from %s\n%s",
|
|
||||||
self.market, self.name, err)
|
self.market, self.name, err)
|
||||||
|
|
||||||
def _update_price(self):
|
def _update_price(self):
|
||||||
|
@ -141,7 +140,10 @@ class LBRYioBTCFeed(MarketFeed):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _handle_response(self, response):
|
def _handle_response(self, response):
|
||||||
|
try:
|
||||||
json_response = json.loads(response)
|
json_response = json.loads(response)
|
||||||
|
except ValueError:
|
||||||
|
raise InvalidExchangeRateResponse("invalid rate response : %s" % response)
|
||||||
if 'data' not in json_response:
|
if 'data' not in json_response:
|
||||||
raise InvalidExchangeRateResponse(self.name, 'result not found')
|
raise InvalidExchangeRateResponse(self.name, 'result not found')
|
||||||
return defer.succeed(1.0 / json_response['data']['btc_usd'])
|
return defer.succeed(1.0 / json_response['data']['btc_usd'])
|
||||||
|
|
Loading…
Reference in a new issue