forked from LBRYCommunity/lbry-sdk
use util.aiohttp
Fix certificate errors
This commit is contained in:
parent
abf2ca40a2
commit
60dc43340d
1 changed files with 3 additions and 3 deletions
|
@ -3,7 +3,7 @@ import time
|
||||||
import hashlib
|
import hashlib
|
||||||
import binascii
|
import binascii
|
||||||
|
|
||||||
import aiohttp
|
from lbrynet import utils
|
||||||
import ecdsa
|
import ecdsa
|
||||||
from torba.client.hash import sha256
|
from torba.client.hash import sha256
|
||||||
from lbry.wallet.transaction import Output
|
from lbry.wallet.transaction import Output
|
||||||
|
@ -47,10 +47,10 @@ def sign_comment(comment: dict, channel: Output):
|
||||||
async def jsonrpc_post(url: str, method: str, **params) -> any:
|
async def jsonrpc_post(url: str, method: str, **params) -> any:
|
||||||
json_body = {'jsonrpc': '2.0', 'id': None, 'method': method, 'params': params}
|
json_body = {'jsonrpc': '2.0', 'id': None, 'method': method, 'params': params}
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
async with aiohttp.request('POST', url, json=json_body, headers=headers) as response:
|
async with utils.aiohttp_request('POST', url, json=json_body, headers=headers) as response:
|
||||||
try:
|
try:
|
||||||
result = await response.json()
|
result = await response.json()
|
||||||
return result['result'] if 'result' in result else result
|
return result['result'] if 'result' in result else result
|
||||||
except aiohttp.client.ContentTypeError as cte:
|
except Exception as cte:
|
||||||
log.exception('Unable to decode respose from server: %s', cte)
|
log.exception('Unable to decode respose from server: %s', cte)
|
||||||
return await response.text()
|
return await response.text()
|
||||||
|
|
Loading…
Reference in a new issue